On Mon, May 20, 2002 at 06:13:23PM +0000, Mark Finlay wrote:
> I want to be able to change a users home directory in a shell script
> (ie. without manually editing /etc/passwd).
>> man passwd says that passwd -h <username> should do it but when i do
> that it just says "Password changed"
>> Short of that is there any way to automagically change /home/guest to
> /local/guest in the /etc/passwd file via bash a perl script.
Not sure if this is what you want but perl will do EXACTLY the above with
this one liner:
perl -pi -e "s^/home/guest^/local/guest^" /etc/passwd
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!