Jump to content

User Admin: Login Shell editing problem [solved]


Peter Snow
 Share

Recommended Posts

I seem to have messed up one of the users on the system and need some help to please!

 

When I was trying to change the users home directory, something seems to have gone wrong and everytime I saved my changes in Mandriva Control Center, the Login Shelll field, gets duplicated to itself.

 

This has resulted in the field currently set to:

:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash

:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash:/bin/bash

:/bin/bash

 

I´ve tried all the obvious stuff like delete it, change it, etc and those do not help. I´m wondering if this is saved somewhere in plain text, where I can just edit the text of a text file and save it?

 

I´m running Mandriva ONE 2008.

 

Thanks in advance.

 

peter

Link to comment
Share on other sites

This information is saved in /etc/passwd. For user 'peter' the line would look something like this:

peter:x:501:501:Whatever comment you gave during install:/home/peter:/bin/bash

I guess in your case it reads /bin/bash:/bin/bash etc.

 

Be very carefull when editing this file (only possible as root). Mistakes may mean several users including yourself have no access anymore thus rendering your system unusable.

 

An alternative approach is by using the usermod command. The following command should move the current home-dir for user peter (assumed to be /home/peter) from '/home/peter' to '/home/new':

usermod -d /home/new -m peter

Again this is only possible as root.

Link to comment
Share on other sites

Thanks buddy, I'll give it a try modifying the file (or I will at least have a look at it when I can get on the machine). So long as I don't do anything stupid, I guess I should be safe.

 

I can't use the command line option since I'm not trying to move the home directory right now. I'm just trying to correct the issue with the shell.

 

I'll let you know how I get on. :)

Link to comment
Share on other sites

Just a quick word of warning. Editing /etc/passwd can sometimes be a bad thing. Especially if a system has shadow passwords, which most tend to nowadays. Screwing with /etc/passwd can end up with completely blocking any user from accessing the system, including root!

 

I guess you were lucky this time, but something to point out in case you need to do this again. I can't remember exactly how I did it last time, or how I recovered or even if I recovered.

 

usermod is best for sorting the bash thing:

 

usermod -s /bin/bash username

 

would modify the user without having to directly edit the /etc/passwd file, replacing username in the above with the user that was screwed up.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...