LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   change user pwd in script? (https://www.linuxquestions.org/questions/linux-general-1/change-user-pwd-in-script-241694/)

slug420 10-12-2004 09:07 AM

change user pwd in script?
 
how can I change the current path of a user executing the script?

so that for example they type "./changeme" and it moves them from their current directory to a different one

I have a script right now that I want to put the user in a different directory when it exits but it the "cd /blah/blah" command at the end of the script has no effect on the user...

thanks!

trickykid 10-12-2004 09:24 AM

I don't see the point in making them change their directory if it doesn't change any outcome in the process of changing their password, it would only mislead them in their pwd, etc.

All users with a valid shell can invoke the passwd command to change their passwords, etc.

I'd say either create an alias for all users called changme that links to 'passwd' or you can create a symlink to it as well.

But if you insist:

Code:

#!/bin/bash

cd /some/directory

passwd

And if you want to let them know what directory they are in after running this, well, throw a pwd command at the end of the script.

slug420 10-12-2004 10:26 AM

woops, sorry bout that

by pwd i meant present working directory....their current path :)

im just trying to have this script change the current directory of the user that is running it so I can dictate their path when the script is finished and they are returned to a command prompt


All times are GMT -5. The time now is 04:58 AM.