Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
[EMAIL PROTECTED] wrote: I would not recommend using vipw [...] to change your users' shells. Why not? --Alex ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
+++ Alex Zbyslaw [freebsd] [10-10-06 11:57 +0100]: | [EMAIL PROTECTED] wrote: | | I would not recommend using vipw [...] to change your users' shells. | | Why not? | | --Alex man pw and look for '-s' option Though it many need little bit of scripting. This may be useful to automate the process. But if for one time change, I would prefer vipw. -- Ignore everybody. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
Because that's what pw is for...you don't need to worry about accidentally deleting a colon, for example. A script using pw would also be a huge timesaver over manually editing hundreds of entries, I'd think as well. Of course, sed can do it even quicker, but with the same risks. On Tue, 10 Oct 2006, Alex Zbyslaw wrote: [EMAIL PROTECTED] wrote: I would not recommend using vipw [...] to change your users' shells. Why not? --Alex James Smallacombe PlantageNet, Inc. CEO and Janitor [EMAIL PROTECTED] http://3.am = ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
How to change all /bin/bash at /etc/passwd to /sbin/nologin?
Dear guru's: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I am looking forward for your great responses. Thank you. Regards, -- James G. Corteciano FreeBSD User ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
Hi James, On Monday 09 October 2006 09:24, James Corteciano wrote: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I think you can do this with: sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd /etc/passwd Best regards, Lothar ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
sed -i .backup s,:/bin/bash$,:/sbin/nologin, /etc/passwd But at least on my FBSD systems bash is in /usr/local/bin/bash, not /bin/bash! And what would you need this for? Cheers, Kurt On Mon, Oct 09, 2006 at 03:24:30PM +0800, James Corteciano wrote: Dear guru's: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I am looking forward for your great responses. Thank you. Regards, -- James G. Corteciano FreeBSD User ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
On 10/9/06, James Corteciano [EMAIL PROTECTED] wrote: Dear guru's: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I am looking forward for your great responses. Thank you. Regards, -- James G. Corteciano FreeBSD User ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] if you have mc (midnight commander) browse to /etc/passwd, edit - replace if you don't then pkg_add -r mc or vi /etc/passwd :%s//bin/bash//sbin/nologin/cg (:%s/oldstring/newstring/cg) ZZ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
El día Monday, October 09, 2006 a las 09:41:38AM +0200, Lothar Braun escribió: Hi James, On Monday 09 October 2006 09:24, James Corteciano wrote: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I think you can do this with: sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd /etc/passwd DONT DO THAT this way. The result would be that your actual shell truncates the file '/etc/passwd' to zero length and then launches the 'sed'. In FreeBSD you must use 'vipw' (see its man page) and in the vi launched by 'vipw' you may use something like: :1,$s-/bin/bash$-/sbin/nologin- Only do this if your familar with 'vi'. matthias -- Matthias Apitz Manager Technical Support - OCLC PICA GmbH Gruenwalder Weg 28g - 82041 Oberhaching - Germany t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e [EMAIL PROTECTED] - w http://www.oclcpica.org/ http://guru.UnixLand.de/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
Hi Lothar, Thanks for your response. How about if all uid's that =500 at passwd file must change from /bin/bash to /sbin/nologin? Thank you. Best regards, James C. FreeBSD User On 10/9/06, Lothar Braun [EMAIL PROTECTED] wrote: Hi James, On Monday 09 October 2006 09:24, James Corteciano wrote: How to change all word lines of /bin/bash at /etc/passwd file to /sbin/nologin in just a single line command? I think you can do this with: sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd /etc/passwd Best regards, Lothar ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] -- James G. Corteciano FreeBSD User ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
On Monday 09 October 2006 10:03, Matthias Apitz wrote: sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd /etc/passwd DONT DO THAT this way. The result would be that your actual shell truncates the file '/etc/passwd' to zero length and then launches the 'sed'. Damn. I just built the regexp but didn't check what the command does before i sent it to the list. Sorry for that. I hope nobody killed his pw-file because of my advice :/ -- Lothar ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
Dear guru's, Thanks all you guys for the great response. Now, I've done it using text-editor of NANO and there is Find, and To Replace section which makes big help to replacing the whole word. Best regards, James Corteciano FreeBSD User On 10/9/06, Lothar Braun [EMAIL PROTECTED] wrote: On Monday 09 October 2006 10:03, Matthias Apitz wrote: sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd /etc/passwd DONT DO THAT this way. The result would be that your actual shell truncates the file '/etc/passwd' to zero length and then launches the 'sed'. Damn. I just built the regexp but didn't check what the command does before i sent it to the list. Sorry for that. I hope nobody killed his pw-file because of my advice :/ -- Lothar -- James G. Corteciano FreeBSD User ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin?
I would not recommend using vipw or sed to change your users' shells. I'd just create a file of users: cat /etc/passwd | cut -f1 -d: userlist (Edit out any users you don't want to include): then a scipt using pw to change their shells #!/bin/sh user=`awk '{print $1}' ./userlist` for user in $user do pw usermod $user -s /sbin/nologin done James Smallacombe PlantageNet, Inc. CEO and Janitor [EMAIL PROTECTED] http://3.am = ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]