LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-12-2004, 09:07 AM   #1
slug420
Member
 
Registered: Jul 2004
Posts: 68

Rep: Reputation: 15
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!
 
Old 10-12-2004, 09:24 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
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.
 
Old 10-12-2004, 10:26 AM   #3
slug420
Member
 
Registered: Jul 2004
Posts: 68

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change user in bash script c0d3 Programming 6 07-27-2005 11:34 AM
How-to setup Linux without user & pwd ioan123 Linux - Security 2 03-21-2005 07:48 AM
how to change PWD in a shell script slug420 Linux - General 8 01-29-2005 07:27 AM
Change proc value as a user in a script? Brian1 Linux - General 3 01-26-2005 07:57 PM
How to change to root user within a script? bjdea1 Linux - Software 1 09-07-2004 09:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration