From filipp at mac.com Sun Jun 3 00:30:02 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Sun Jun 3 00:30:05 2007 Subject: [X-Unix] find's -quit Message-ID: Hi gang, Just a quick question that kinda stumped me. How do you limit find's search results to just the first result? GNU find has -quit (http://unixhelp.ed.ac.uk/CGI/man-cgi?find) but I can't seem to find any equivalent on OS X. This is for performance reasons so head is not an option. Many TIA, -filipp - - Filipp Lepalaan filipp@mac.com http://unflyingobject.com - - From sforbes42 at earthlink.net Sun Jun 3 07:21:07 2007 From: sforbes42 at earthlink.net (Scott Forbes) Date: Sun Jun 3 07:21:18 2007 Subject: [X-Unix] find's -quit In-Reply-To: References: Message-ID: On Jun 3, 2007, at 12:30 AM, Filipp Lepalaan wrote: > Hi gang, > > Just a quick question that kinda stumped me. How do you limit > find's search results to just the first result? > GNU find has -quit (http://unixhelp.ed.ac.uk/CGI/man-cgi?find) but > I can't seem to find any equivalent on OS X. > > This is for performance reasons so head is not an option. I don't see that option either, but if stuck you could get findutils from DarwinPorts and use gfind: -> sudo port install findutils ... -> cd /opt/local/bin -> gfind -name 'g*' -print -quit ./qawk -> From filipp at mac.com Sun Jun 3 07:53:08 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Sun Jun 3 07:51:45 2007 Subject: [X-Unix] find's -quit In-Reply-To: References: Message-ID: On 03.06.2007, at 17:21, Scott Forbes wrote: > On Jun 3, 2007, at 12:30 AM, Filipp Lepalaan wrote: > >> Hi gang, >> >> Just a quick question that kinda stumped me. How do you limit >> find's search results to just the first result? >> GNU find has -quit (http://unixhelp.ed.ac.uk/CGI/man-cgi?find) but >> I can't seem to find any equivalent on OS X. >> >> This is for performance reasons so head is not an option. > > I don't see that option either, but if stuck you could get > findutils from DarwinPorts and use gfind: > > -> sudo port install findutils > ... > -> cd /opt/local/bin > -> gfind -name 'g*' -print -quit > ./qawk > -> Thanks for the info, Scott. Unfortunately this is for something that should run on anyone's Mac (it's actually a piece of a larger AppleScript utility). -filipp From ecrist at secure-computing.net Sun Jun 3 08:13:51 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Sun Jun 3 08:14:07 2007 Subject: [X-Unix] find's -quit In-Reply-To: References: Message-ID: On Jun 3, 2007, at 2:30 AMJun 3, 2007, Filipp Lepalaan wrote: > Hi gang, > > Just a quick question that kinda stumped me. How do you limit > find's search results to just the first result? > GNU find has -quit (http://unixhelp.ed.ac.uk/CGI/man-cgi?find) but > I can't seem to find any equivalent on OS X. > > This is for performance reasons so head is not an option. > > > Many TIA, > -filipp > If you can give me a specific example of what you're searching for and in what context, I can probably foo some sort of script together that will do what you need. Just a matter of piping the right things together... ----- Eric F Crist Secure Computing Networks From filipp at mac.com Sun Jun 3 10:06:17 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Sun Jun 3 10:05:00 2007 Subject: [X-Unix] find's -quit In-Reply-To: References: Message-ID: <94E3E68D-E284-469F-AB20-45A26F77DD5B@mac.com> On 03.06.2007, at 18:13, Eric F Crist wrote: > If you can give me a specific example of what you're searching for > and in what context, I can probably foo some sort of script > together that will do what you need. Just a matter of piping the > right things together... Thanks, Eric. This seems to do what I want: find ~/Library/Mail | grep 210534.*emlx -m 1 The particular script searches for emails with a particular message ID. There may be tens of thousands of them so that's why I was so concerned about just quiting after the first match. Just out of curiosity, what's the reason behind that particular command returning right after the first match (ie the grep effectively stopping find) while head -n 1 has to sit through the whole traversal? -filipp From filipp at mac.com Sun Jun 3 10:10:08 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Sun Jun 3 10:08:49 2007 Subject: [X-Unix] Article: Terminal Productivity Tips Message-ID: Hi all, A bit of a shameless plug, I guess but just thought there might be poeple on this list interested in an article I recently wrote for afp548.com: http://www.afp548.com/article.php?story=20070525141734763 Some great comments at the end there. -filipp From macdaddee at gmail.com Thu Jun 7 20:08:38 2007 From: macdaddee at gmail.com (Mac Daddy) Date: Thu Jun 7 20:08:48 2007 Subject: [X-Unix] Article: Terminal Productivity Tips In-Reply-To: References: Message-ID: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Very good article! Thanks! There were several things in there that I had forgotten how to do and were looking for. -md On Jun 3, 2007, at 1:10 PM, Filipp Lepalaan wrote: > Hi all, > > A bit of a shameless plug, I guess but just thought there might be > poeple on this list interested in an article I recently wrote for > afp548.com: > http://www.afp548.com/article.php?story=20070525141734763 > > Some great comments at the end there. > > > -filipp > > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix > > Listmom is trying to clean out his closets! Vintage Mac and random > stuff: > http://search.ebay.com/_W0QQsassZmacguy1984 From kuestner at macnews.de Fri Jun 8 07:05:32 2007 From: kuestner at macnews.de (B. Kuestner) Date: Fri Jun 8 07:06:24 2007 Subject: [X-Unix] Article: Terminal Productivity Tips In-Reply-To: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Message-ID: Well done. Thanks. Not the standard I-already-knew-all-that-stuff from other shell primers. Bj?rn From filipp at mac.com Fri Jun 8 12:14:16 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Fri Jun 8 12:13:05 2007 Subject: [X-Unix] Article: Terminal Productivity Tips In-Reply-To: References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Message-ID: Many thanks to all for the comments! -filipp On 08.06.2007, at 17:05, B. Kuestner wrote: > Well done. Thanks. > > Not the standard I-already-knew-all-that-stuff from other shell > primers. > > Bj?rn From RussellMcGaha at mac.com Fri Jun 8 16:24:56 2007 From: RussellMcGaha at mac.com (Russell McGaha) Date: Fri Jun 8 16:25:48 2007 Subject: [X-Unix] Application usage reporting Message-ID: Folks; 1st, PLEASE excuse the cross post ! 2nd, I need some help; I need to gather usage info on the front most app. on several computers. What I'd LIKE is something that gathered the info in the background for a specified period of time [8-am to 5- pm usually] and sent a consolidated text file to me each evening; anyone know of anything close?? Or have a snippet of applescript, bash, ..ect., that I might turn into what I need?? TIA Russell From hess at yacht.com Sun Jun 10 12:12:58 2007 From: hess at yacht.com (Paul Hess) Date: Sun Jun 10 12:13:06 2007 Subject: [X-Unix] ssh sudo password in clear text Message-ID: Hi all, I have a command in my bin directory as follows: ssh someserver.com sudo mailstuff/sa-learn.sh When it executes the remote sudo command, it prompts me for a password which, when I type it, appears on my screen in cleartext rather than hidden. I am using the standard OS/X terminal. Is there some way I can avoid having that password appear in cleartext? TIA! - Paul From ecrist at secure-computing.net Sun Jun 10 12:41:38 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Sun Jun 10 12:41:51 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: References: Message-ID: On Jun 10, 2007, at 2:12 PMJun 10, 2007, Paul Hess wrote: > Hi all, > > I have a command in my bin directory as follows: > > ssh someserver.com sudo mailstuff/sa-learn.sh > > When it executes the remote sudo command, it prompts me for a > password which, when I type it, appears on my screen in cleartext > rather than hidden. I am using the standard OS/X terminal. > > Is there some way I can avoid having that password appear in > cleartext? > > TIA! Paul, If you're the owner of that box, I would recommend making that password non-required through your sudo configuration. An couple entries such as follows would work nicely for you: username ALL = NOPASSWD: /full/path/to/script/mailstuff/sa-learn.sh username ALL = (ALL) ALL (*There are ways to make this all on one line, but I write it this way for readability. See man sudoers(5) for more examples) The first entry allows the command, and only that command, to be executed with sudo, without a password. A great feature if you're automating anything that requires sudo access (some questionable web site packages require this (oreon, www.oreon-project.org, for one). The second command allows your user to execute all other commands via sudo, requiring a password. The full path above is required for any security conscious administrator, otherwise, if I got access to username's account, I could create any arbitrary mailstuff directory with an sa-learn.sh script within and execute any command I wanted as root, without having to know your password. My recommendation would be to use /etc/crontab or AT to perform the above task, automatically, at your predetermined intervals. HTH. If there's any questions you've got, let me know, I can possibly help you out. ----- Eric F Crist Secure Computing Networks From hess at yacht.com Sun Jun 10 13:01:20 2007 From: hess at yacht.com (Paul Hess) Date: Sun Jun 10 13:01:25 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: References: Message-ID: Hi Eric, I don't have exclusive access to that machine, but I suppose if I make the sa-learn.sh script only editable by the super-user I should be pretty safe. (otherwise someone could edit it to do whatever they want with no pw required!). Instead of making no PW required, is there some way I can supply the password within the command line on my calling machine? I have control over that one so I don't really mind embedding the password into the script. Thanks for the tips! - Paul On Jun 10, 2007, at 3:41 PM, Eric F Crist wrote: > On Jun 10, 2007, at 2:12 PMJun 10, 2007, Paul Hess wrote: > >> Hi all, >> >> I have a command in my bin directory as follows: >> >> ssh someserver.com sudo mailstuff/sa-learn.sh >> >> When it executes the remote sudo command, it prompts me for a >> password which, when I type it, appears on my screen in cleartext >> rather than hidden. I am using the standard OS/X terminal. >> >> Is there some way I can avoid having that password appear in >> cleartext? >> >> TIA! > > Paul, > > If you're the owner of that box, I would recommend making that > password non-required through your sudo configuration. An couple > entries such as follows would work nicely for you: > > username ALL = NOPASSWD: /full/path/to/script/mailstuff/sa-learn.sh > username ALL = (ALL) ALL > > (*There are ways to make this all on one line, but I write it this > way for readability. See man sudoers(5) for more examples) > > The first entry allows the command, and only that command, to be > executed with sudo, without a password. A great feature if you're > automating anything that requires sudo access (some questionable > web site packages require this (oreon, www.oreon-project.org, for > one). > > The second command allows your user to execute all other commands > via sudo, requiring a password. > The full path above is required for any security conscious > administrator, otherwise, if I got access to username's account, I > could create any arbitrary mailstuff directory with an sa-learn.sh > script within and execute any command I wanted as root, without > having to know your password. > > My recommendation would be to use /etc/crontab or AT to perform the > above task, automatically, at your predetermined intervals. > > HTH. If there's any questions you've got, let me know, I can > possibly help you out. > > ----- > Eric F Crist > Secure Computing Networks > > > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix > > Listmom is trying to clean out his closets! Vintage Mac and random > stuff: > http://search.ebay.com/_W0QQsassZmacguy1984 From ecrist at secure-computing.net Sun Jun 10 13:45:11 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Sun Jun 10 13:45:25 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: References: Message-ID: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> On Jun 10, 2007, at 3:01 PMJun 10, 2007, Paul Hess wrote: > > On Jun 10, 2007, at 3:41 PM, Eric F Crist wrote: > >> On Jun 10, 2007, at 2:12 PMJun 10, 2007, Paul Hess wrote: >> >>> Hi all, >>> >>> I have a command in my bin directory as follows: >>> >>> ssh someserver.com sudo mailstuff/sa-learn.sh >>> >>> When it executes the remote sudo command, it prompts me for a >>> password which, when I type it, appears on my screen in cleartext >>> rather than hidden. I am using the standard OS/X terminal. >>> >>> Is there some way I can avoid having that password appear in >>> cleartext? >>> >>> TIA! >> >> Paul, >> >> If you're the owner of that box, I would recommend making that >> password non-required through your sudo configuration. An couple >> entries such as follows would work nicely for you: >> >> username ALL = NOPASSWD: /full/path/to/script/mailstuff/sa-learn.sh >> username ALL = (ALL) ALL >> >> (*There are ways to make this all on one line, but I write it this >> way for readability. See man sudoers(5) for more examples) >> >> The first entry allows the command, and only that command, to be >> executed with sudo, without a password. A great feature if you're >> automating anything that requires sudo access (some questionable >> web site packages require this (oreon, www.oreon-project.org, for >> one). >> >> The second command allows your user to execute all other commands >> via sudo, requiring a password. >> The full path above is required for any security conscious >> administrator, otherwise, if I got access to username's account, I >> could create any arbitrary mailstuff directory with an sa-learn.sh >> script within and execute any command I wanted as root, without >> having to know your password. >> >> My recommendation would be to use /etc/crontab or AT to perform >> the above task, automatically, at your predetermined intervals. >> >> HTH. If there's any questions you've got, let me know, I can >> possibly help you out. >> >> ----- >> Eric F Crist >> Secure Computing Networks > Hi Eric, > > I don't have exclusive access to that machine, but I suppose if I > make the sa-learn.sh script only editable by the super-user I > should be pretty safe. (otherwise someone could edit it to do > whatever they want with no pw required!). > > Instead of making no PW required, is there some way I can supply > the password within the command line on my calling machine? I > have control over that one so I don't really mind embedding the > password into the script. > > Thanks for the tips! Paul, The NOPASSWD entry listed in my previous email will ONLY allow username to execute that command without a password, not just any user on the system, if that makes you feel better. If, however, you still want to execute the command while supplying the password yourself, a command such as this should work: echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh HTH ----- Eric F Crist Secure Computing Networks From hess at yacht.com Sun Jun 10 14:50:51 2007 From: hess at yacht.com (Paul Hess) Date: Sun Jun 10 14:51:02 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> References: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> Message-ID: On Jun 10, 2007, at 4:45 PM, Eric F Crist wrote: > On Jun 10, 2007, at 3:01 PMJun 10, 2007, Paul Hess wrote: >> >> On Jun 10, 2007, at 3:41 PM, Eric F Crist wrote: >> >>> On Jun 10, 2007, at 2:12 PMJun 10, 2007, Paul Hess wrote: >>> >>>> >>>> ssh someserver.com sudo mailstuff/sa-learn.sh > [...] > just any user on the system, if that makes you feel better. If, > however, you still want to execute the command while supplying the > password yourself, a command such as this should work: > > echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh Hi Eric, Here's the rub that brings me back to square one (unless I misunderstand the piping). If I use the command above, wouldn't the password be sent to "ssh" rather than sent to the "sudo" command? I think I somehow need to put echo "password" into the command line after ssh to be piped to sudo but I don't understand the syntax to do that. I believe it has to do with single quotes but I can't find a way to get it right. - Paul From ecrist at secure-computing.net Sun Jun 10 15:31:09 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Sun Jun 10 15:31:19 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: References: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> Message-ID: <080BD80B-3FB1-44A9-BF4A-E684DC56AE3F@secure-computing.net> On Jun 10, 2007, at 4:50 PMJun 10, 2007, Paul Hess wrote: >> echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh > > Hi Eric, > > Here's the rub that brings me back to square one (unless I > misunderstand the piping). > > If I use the command above, wouldn't the password be sent to "ssh" > rather than sent to the "sudo" command? I think I somehow need to > put echo "password" into the command line after ssh to be piped to > sudo but I don't understand the syntax to do that. I believe it > has to do with single quotes but I can't find a way to get it right. Paul, The echo "password" portion of the command gets piped into the entirety of ssh someserver.com sudo mailstuff/sa-learn.sh. In this case, the sudo ... is what reads that input from stdin. To help you understand: foo | bar In the above example, foo is seen as input on stdin from bar('s) perspective. Try the command I sent you, it should work just fine. I tested it on my systems here, an OS X client connecting to a FreeBSD 6.x server, and things went swimmingly. If the command *does*, for some reason, fail, add a -S (hyphen upper S) after sudo and before mailstuff/sa-learn.sh. This option tells sudo to accept the password from stdin rather than a device (read tty). Give it a try and tell me how it goes. HTH *For the record, I don't sit at home on a Sunday waiting for X-Unix email, I, (un)fortunately have the benefit of a [Cr|Bl]ackberry that summons me in the middle of my honey-do list... ;) ----- Eric F Crist Secure Computing Networks From ecrist at secure-computing.net Sun Jun 10 16:06:35 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Sun Jun 10 16:06:51 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: <080BD80B-3FB1-44A9-BF4A-E684DC56AE3F@secure-computing.net> References: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> <080BD80B-3FB1-44A9-BF4A-E684DC56AE3F@secure-computing.net> Message-ID: <84B40233-A3D0-49A4-9DF0-0599DE630E5C@secure-computing.net> On Jun 10, 2007, at 5:31 PMJun 10, 2007, Eric F Crist wrote: > > On Jun 10, 2007, at 4:50 PMJun 10, 2007, Paul Hess wrote: >>> echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh >> >> Hi Eric, >> >> Here's the rub that brings me back to square one (unless I >> misunderstand the piping). >> >> If I use the command above, wouldn't the password be sent to "ssh" >> rather than sent to the "sudo" command? I think I somehow need to >> put echo "password" into the command line after ssh to be piped to >> sudo but I don't understand the syntax to do that. I believe it >> has to do with single quotes but I can't find a way to get it right. > > Paul, > > The echo "password" portion of the command gets piped into the > entirety of ssh someserver.com sudo mailstuff/sa-learn.sh. In this > case, the sudo ... is what reads that input from stdin. > > To help you understand: > > foo | bar > Paul, Something I left out is that in the above example, bar is your ssh command, inclusive of the sudo... stuff. ssh does you a favor by executing that command for you and exiting. So, you have the right idea that the echo command is being pipe into ssh and not sudo. In this particular case, however, sudo is the command that ends up with the piped data (ssh passes it on). HTH ----- Eric F Crist Secure Computing Networks From hess at yacht.com Sun Jun 10 16:15:49 2007 From: hess at yacht.com (Paul Hess) Date: Sun Jun 10 16:15:59 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: <84B40233-A3D0-49A4-9DF0-0599DE630E5C@secure-computing.net> References: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> <080BD80B-3FB1-44A9-BF4A-E684DC56AE3F@secure-computing.net> <84B40233-A3D0-49A4-9DF0-0599DE630E5C@secure-computing.net> Message-ID: On Jun 10, 2007, at 7:06 PM, Eric F Crist wrote: > On Jun 10, 2007, at 5:31 PMJun 10, 2007, Eric F Crist wrote: > >> >> On Jun 10, 2007, at 4:50 PMJun 10, 2007, Paul Hess wrote: >>>> echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh >>> >>> Hi Eric, >>> >>> Here's the rub that brings me back to square one (unless I >>> misunderstand the piping). >>> >>> If I use the command above, wouldn't the password be sent to >>> "ssh" rather than sent to the "sudo" command? I think I somehow >>> need to put echo "password" into the command line after ssh to be >>> piped to sudo but I don't understand the syntax to do that. I >>> believe it has to do with single quotes but I can't find a way to >>> get it right. >> >> Paul, >> >> The echo "password" portion of the command gets piped into the >> entirety of ssh someserver.com sudo mailstuff/sa-learn.sh. In >> this case, the sudo ... is what reads that input from stdin. >> >> To help you understand: >> >> foo | bar >> > > Paul, > > Something I left out is that in the above example, bar is your ssh > command, inclusive of the sudo... stuff. ssh does you a favor by > executing that command for you and exiting. So, you have the right > idea that the echo command is being pipe into ssh and not sudo. In > this particular case, however, sudo is the command that ends up > with the piped data (ssh passes it on). > > HTH > ----- > Eric F Crist > Secure Computing Networks Thanks for all the help Eric! I'll give these a try and let you know. - Paul From kuestner at macnews.de Mon Jun 11 13:45:51 2007 From: kuestner at macnews.de (B. Kuestner) Date: Mon Jun 11 13:46:09 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: References: Message-ID: You could wrap the command in a little script and use stty to turn off that the password is displayed on screen: > stty_orig=`stty -g` > stty -echo > read secret > stty $stty_orig > Example 16-3. secret password: Turning off terminal echoing > > #!/bin/bash > # secret-pw.sh: secret password > > echo > echo -n "Enter password " > read passwd > echo "password is $passwd" > echo -n "If someone had been looking over your shoulder, " > echo "your password would have been compromised." > > echo && echo # Two line-feeds in an "and list." > > > stty -echo # Turns off screen echo. > > echo -n "Enter password again " > read passwd > echo > echo "password is $passwd" > echo > > stty echo # Restores screen echo. > > exit 0 > > # Do an 'info stty' for more on this useful-but-tricky command. Bj?rn From hess at yacht.com Wed Jun 20 02:01:11 2007 From: hess at yacht.com (Paul Hess) Date: Wed Jun 20 02:01:43 2007 Subject: [X-Unix] ssh sudo password in clear text In-Reply-To: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> References: <565F6790-8D93-43B8-B637-41663730E79E@secure-computing.net> Message-ID: Sorry for the delay in replying, but this works like a charm. Thanks!!! On Jun 10, 2007, at 4:45 PM, Eric F Crist wrote: > On Jun 10, 2007, at 3:01 PMJun 10, 2007, Paul Hess wrote: >> >> On Jun 10, 2007, at 3:41 PM, Eric F Crist wrote: >> >>> On Jun 10, 2007, at 2:12 PMJun 10, 2007, Paul Hess wrote: >>> >>>> Hi all, >>>> >>>> I have a command in my bin directory as follows: >>>> >>>> ssh someserver.com sudo mailstuff/sa-learn.sh >>>> >>>> When it executes the remote sudo command, it prompts me for a >>>> password which, when I type it, appears on my screen in >>>> cleartext rather than hidden. I am using the standard OS/X >>>> terminal. >>>> >>>> Is there some way I can avoid having that password appear in >>>> cleartext? >>>> >>>> TIA! >>> >>> Paul, >>> >>> If you're the owner of that box, I would recommend making that >>> password non-required through your sudo configuration. An couple >>> entries such as follows would work nicely for you: >>> >>> username ALL = NOPASSWD: /full/path/to/script/mailstuff/sa-learn.sh >>> username ALL = (ALL) ALL >>> >>> (*There are ways to make this all on one line, but I write it >>> this way for readability. See man sudoers(5) for more examples) >>> >>> The first entry allows the command, and only that command, to be >>> executed with sudo, without a password. A great feature if >>> you're automating anything that requires sudo access (some >>> questionable web site packages require this (oreon, www.oreon- >>> project.org, for one). >>> >>> The second command allows your user to execute all other commands >>> via sudo, requiring a password. >>> The full path above is required for any security conscious >>> administrator, otherwise, if I got access to username's account, >>> I could create any arbitrary mailstuff directory with an sa- >>> learn.sh script within and execute any command I wanted as root, >>> without having to know your password. >>> >>> My recommendation would be to use /etc/crontab or AT to perform >>> the above task, automatically, at your predetermined intervals. >>> >>> HTH. If there's any questions you've got, let me know, I can >>> possibly help you out. >>> >>> ----- >>> Eric F Crist >>> Secure Computing Networks > >> Hi Eric, >> >> I don't have exclusive access to that machine, but I suppose if I >> make the sa-learn.sh script only editable by the super-user I >> should be pretty safe. (otherwise someone could edit it to do >> whatever they want with no pw required!). >> >> Instead of making no PW required, is there some way I can supply >> the password within the command line on my calling machine? I >> have control over that one so I don't really mind embedding the >> password into the script. >> >> Thanks for the tips! > > Paul, > > The NOPASSWD entry listed in my previous email will ONLY allow > username to execute that command without a password, not just any > user on the system, if that makes you feel better. If, however, > you still want to execute the command while supplying the password > yourself, a command such as this should work: > > echo "password" | ssh someserver.com sudo mailstuff/sa-learn.sh > > HTH > > ----- > Eric F Crist > Secure Computing Networks > > > _______________________________________________ > X-Unix mailing list > X-Unix@listserver.themacintoshguy.com > http://listserver.themacintoshguy.com/mailman/listinfo/x-unix > > Listmom is trying to clean out his closets! Vintage Mac and random > stuff: > http://search.ebay.com/_W0QQsassZmacguy1984 From robhoy at pha.jhu.edu Wed Jun 20 10:27:52 2007 From: robhoy at pha.jhu.edu (Robert Hoy) Date: Wed Jun 20 10:25:05 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Message-ID: Hi. Is there an efficient way to find files which are present in both gzipped and ungzipped form? They would be in the same directory, but I would like to search across all directories from one at high level. That is, I want to find all cases where "a" and "a.gz" are present in the same directory. Thanks, Rob From ecrist at secure-computing.net Wed Jun 20 11:12:45 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Wed Jun 20 11:13:21 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Message-ID: On Jun 20, 2007, at 12:27 PMJun 20, 2007, Robert Hoy wrote: > Hi. Is there an efficient way to find files which are present in > both gzipped and ungzipped form? > They would be in the same directory, but I would like to search > across all directories from one at high level. That is, I want to > find all cases where "a" and "a.gz" are present in the same directory. > > Thanks, > Rob > If you've got perl available, here's what I used: #!/usr/bin/perl foreach $file (`find . | grep -v .gz`) { chomp($file = $file); if (-e "$file.gz"){ print "$file\n"; } } If you don't want to put that in a file and run it, you can do the following just as easily: From a command prompt: perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = $file ) ; if ( -e "$file.gz" ) { print "$file\n" ; } }' This will search all directories from where it's run for file and if file.gz exists, it will print the file name and directory. Note, this doesn't search to see if file and file.gz exist in different directories. ----- Eric F Crist Secure Computing Networks From robhoy at pha.jhu.edu Wed Jun 20 11:37:28 2007 From: robhoy at pha.jhu.edu (Robert Hoy) Date: Wed Jun 20 11:34:41 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> Message-ID: <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> It worked. Thanks! Rob On Jun 20, 2007, at 2:12 PM, Eric F Crist wrote: > perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = > $file ) ; if ( -e "$file.gz" ) { print "$file\n" ; } }' -------------- next part -------------- An HTML attachment was scrubbed... URL: http://listserver.themacintoshguy.com/pipermail/x-unix/attachments/20070620/37e49218/attachment.html From ecrist at secure-computing.net Wed Jun 20 11:44:19 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Wed Jun 20 11:44:28 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> Message-ID: <97538B91-2A29-4395-95DB-B8288698E733@secure-computing.net> On Jun 20, 2007, at 1:37 PMJun 20, 2007, Robert Hoy wrote: > It worked. Thanks! > Rob > > > > On Jun 20, 2007, at 2:12 PM, Eric F Crist wrote: > >> perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file >> = $file ) ; if ( -e "$file.gz" ) { print "$file\n" ; } }' >> Glad to hear I could help! ----- Eric F Crist Secure Computing Networks From ecrist at secure-computing.net Wed Jun 20 11:47:07 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Wed Jun 20 11:47:21 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> Message-ID: <96C478D7-6F56-4F87-B82D-C1330A9FCCA1@secure-computing.net> In case you wanted to know, you could gzip anything that's not already gzipped by doing a similar command: perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = $file ) ; if ( -ne "$file.gz" ) { print "gzipping file: $file; gzip $file; } }' ----- Eric F Crist Secure Computing Networks From ecrist at secure-computing.net Wed Jun 20 11:54:07 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Wed Jun 20 11:54:18 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: <96C478D7-6F56-4F87-B82D-C1330A9FCCA1@secure-computing.net> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> <96C478D7-6F56-4F87-B82D-C1330A9FCCA1@secure-computing.net> Message-ID: <93DB8150-B951-4CA5-B3FC-C2403E5100C1@secure-computing.net> On Jun 20, 2007, at 1:47 PMJun 20, 2007, Eric F Crist wrote: > In case you wanted to know, you could gzip anything that's not > already gzipped by doing a similar command: > > perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = > $file ) ; if ( -ne "$file.gz" ) { print "gzipping file: $file; gzip > $file; } }' > Sorry to reply to myself, but I'm wrong! the line should be: perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = $file ) ; if ( !-e "$file.gz" ) { print "gzipping file: $file; gzip $file; } }' ----- Eric F Crist Secure Computing Networks From dhiggins at mchsi.com Wed Jun 20 12:19:15 2007 From: dhiggins at mchsi.com (Dave Higgins) Date: Wed Jun 20 12:19:29 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: <93DB8150-B951-4CA5-B3FC-C2403E5100C1@secure-computing.net> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> <96C478D7-6F56-4F87-B82D-C1330A9FCCA1@secure-computing.net> <93DB8150-B951-4CA5-B3FC-C2403E5100C1@secure-computing.net> Message-ID: <4AD5CCD6-8408-46AC-9597-12F2FAE4CD35@mchsi.com> On Jun 20, 2007, at 1:54 PM, Eric F Crist wrote: > Sorry to reply to myself, but I'm wrong! the line should be: > > perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file = > $file ) ; if ( !-e "$file.gz" ) { print "gzipping file: $file; gzip > $file; } }' Love these little one-liners... But, I'm drawing errors when testing this... in sh: Can't find string terminator '"' anywhere before EOF at -e line 1. in tcsh: -e: Event not found. The first one, in reply to the OP, works great, though. :-) Dave. From ecrist at secure-computing.net Wed Jun 20 12:35:59 2007 From: ecrist at secure-computing.net (Eric F Crist) Date: Wed Jun 20 12:36:10 2007 Subject: [X-Unix] finding duplicate files In-Reply-To: <4AD5CCD6-8408-46AC-9597-12F2FAE4CD35@mchsi.com> References: <9E6D40E2-96AE-4F63-B0AA-DCFE4CA778B0@gmail.com> <894045C6-5070-4946-B9F5-70B069886DB6@pha.jhu.edu> <96C478D7-6F56-4F87-B82D-C1330A9FCCA1@secure-computing.net> <93DB8150-B951-4CA5-B3FC-C2403E5100C1@secure-computing.net> <4AD5CCD6-8408-46AC-9597-12F2FAE4CD35@mchsi.com> Message-ID: On Jun 20, 2007, at 2:19 PMJun 20, 2007, Dave Higgins wrote: > > On Jun 20, 2007, at 1:54 PM, Eric F Crist wrote: > >> Sorry to reply to myself, but I'm wrong! the line should be: >> >> perl -e 'foreach $file ( `find . | grep -v .gz` ) { chomp ( $file >> = $file ) ; if ( !-e "$file.gz" ) { print "gzipping file: $file; >> gzip $file; } }' > > Love these little one-liners... But, I'm drawing errors when > testing this... > > in sh: Can't find string terminator '"' anywhere before EOF at -e > line 1. > > in tcsh: -e: Event not found. > > The first one, in reply to the OP, works great, though. :-) > > Dave. > I promise I'll test it before I post next time. Here's the working line, minus my two typos: perl -e 'foreach $file (`file . | grep -v .gz`) { chomp($file); if (! -e "$file.gz") { print "gzipping file: $file" `gzip $file`; }}' Thanks for playing! ----- Eric F Crist Secure Computing Networks From arvee.klesk at gmail.com Sat Jun 30 18:49:17 2007 From: arvee.klesk at gmail.com (Arvee Klesk) Date: Sat Jun 30 20:42:49 2007 Subject: [X-Unix] Add user via command line... Message-ID: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> I've spent some time searching for a command to add a user (apropos, info) in Mac OS X 10.4.8...Anyone with the same trouble ??? On FreeBSD is adduser, and voila !!! the prompt then ask for some data, so the user is added finally. Thanks list. Cheers / Me From ecrist at secure-computing.net Sat Jun 30 20:50:59 2007 From: ecrist at secure-computing.net (=?utf-8?B?RXJpYyBGIENyaXN0?=) Date: Sat Jun 30 20:51:18 2007 Subject: [X-Unix] Add user via command line... In-Reply-To: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> References: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> Message-ID: <1223092119-1183261871-cardhu_decombobulator_blackberry.rim.net-1180855956-@bxe037.bisx.prod.on.blackberry> Adduser is a shell script, which calls the pw command. Not at a terminal now, but try that. --- Eric F Crist Secure Computing Networks -----Original Message----- From: "Arvee Klesk" Date: Sat, 30 Jun 2007 21:49:17 To:"Mac OS X - Unix" Subject: [X-Unix] Add user via command line... I've spent some time searching for a command to add a user (apropos, info) in Mac OS X 10.4.8...Anyone with the same trouble ??? On FreeBSD is adduser, and voila !!! the prompt then ask for some data, so the user is added finally. Thanks list. Cheers / Me _______________________________________________ X-Unix mailing list X-Unix@listserver.themacintoshguy.com http://listserver.themacintoshguy.com/mailman/listinfo/x-unix Listmom is trying to clean out his closets! Vintage Mac and random stuff: http://search.ebay.com/_W0QQsassZmacguy1984 From robg at macosxhints.com Sat Jun 30 20:56:43 2007 From: robg at macosxhints.com (Rob Griffiths) Date: Sat Jun 30 20:56:59 2007 Subject: [X-Unix] Add user via command line... In-Reply-To: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> References: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> Message-ID: <551ACEE5-7131-4C23-BC3F-60B84177B11F@macosxhints.com> On Jun 30, 2007, at 6:49 PM, Arvee Klesk wrote: > I've spent some time searching for a command to add a user > (apropos, info) in Mac OS X 10.4.8...Anyone with the same > trouble ??? On FreeBSD is adduser, and voila !!! the prompt then > ask for some data, so the user is Kirk McElhearn wrote about this back in 2004, and apparently his solution still works in 10.4 (check the comments for enhancements, etc.): http://www.mcelhearn.com/article.php?story=2004110211244242 regards, -rob. From filipp at mac.com Sat Jun 30 22:58:35 2007 From: filipp at mac.com (Filipp Lepalaan) Date: Sat Jun 30 22:59:00 2007 Subject: [X-Unix] Add user via command line... In-Reply-To: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> References: <000501c7bb91$d587fe60$1555a8c0@nd1ced6d1e0d24> Message-ID: <77D81C28-1300-4335-BC02-9FC78D1233ED@mac.com> I use dscl. I wrote this simple useradd-like script available here: http://unflyingobject.com/tarkvara/files/useradd.sh The important dscl commands start on line 51. ... hopefully that's useful. -filipp On 01.07.2007, at 4:49, Arvee Klesk wrote: > I've spent some time searching for a command to add a user > (apropos, info) in Mac OS X 10.4.8...Anyone with the same > trouble ??? On FreeBSD is adduser, and voila !!! the prompt then > ask for some data, so the user is added finally. Thanks list. > > Cheers / Me