LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   User add already exist (https://www.linuxquestions.org/questions/linux-newbie-8/user-add-already-exist-928087/)

newbie14 02-07-2012 08:17 AM

User add already exist
 
Dear All,
I am trying to chroot a user to just a folder and trying to follow the steps here http://www.thisisnotsupported.com/sf...il-on-centos6/ .The problem I am stuck here useradd -d /usr/local/test1 -s /bin/false -G sftponly user1 it gives me useradd: user 'user1' already exits. The problem I have add user1 before this steps. So how to go about it.

deep27ak 02-07-2012 08:22 AM

If it is just a test user which you created then delete the user and recreate changing the default home directory and shell

and if the user is useful then

Code:

#usermod -d (path to new dir) -s (path to new shell) username

colorpurple21859 02-07-2012 08:24 AM

usermod may be what your looking for to modify an already existing user,
edit, i was a little slow in posting, deep27ak was quicker lol

newbie14 02-07-2012 09:34 AM

Dear All,
I can delete but for learning purpose I would like to try to am I doing this rite
usermod -d /usr/local/test1 -s test1 I do not know what to put for the path of new shell?

Satyaveer Arya 02-07-2012 03:30 PM

Quote:

# usermod -d /usr/local/test1 -s test1
This will give you the error because you haven't given the shell.

You can do like this if you want to give /bin/bash shell.

Quote:

# usermod -d /usr/local/test1 -s /bin/bash test1
For more information about usermod:

Quote:

# man usermod
And also check these pages for useradd and usermod:

http://www.cyberciti.biz/faq/tag/useradd-command/
http://www.cyberciti.biz/faq/tag/usermod-command/

deep27ak 02-07-2012 10:08 PM

Quote:

Originally Posted by newbie14 (Post 4596023)
Dear All,
I can delete but for learning purpose I would like to try to am I doing this rite
usermod -d /usr/local/test1 -s test1 I do not know what to put for the path of new shell?

Code:

#usermod -d (path to dir) -s (path to shell) -G (group name) username
in your case
Code:

#usermod -d /usr/local/test1 -s /bin/false -G sftponly user1

newbie14 02-08-2012 12:47 AM

Dear All,
Thank you all that works and even the securing works the user can just sftp and see only one folder. Will there be any loophole for this sort of settings where they can access the other files via other routes?

deep27ak 02-08-2012 12:56 AM

If you have used chroot for any user then he/she will not be allowed to move out of his/her box.

and I believe you got your answer so Please mark the thread as "solved"

newbie14 02-08-2012 12:19 PM

Dear Deepak,
Where is the solved button?

Satyaveer Arya 02-08-2012 12:41 PM

Go on the thread where all the post are shown on the top right corner you will see the place where it is written
"Please Mark this thread as solved if you feel a solution has been provided. "
just above were it is written "Post Reply"

newbie14 02-09-2012 12:50 AM

Dear Deepak,
Ok what I can see right left top is post reply and below is a row with Thread Tools LinkBack Search this Thread Rate Thread ? So I still dont see the marked as solved? Thank you.

deep27ak 02-09-2012 01:03 AM

Quote:

Originally Posted by newbie14 (Post 4597755)
Dear Deepak,
Ok what I can see right left top is post reply and below is a row with Thread Tools LinkBack Search this Thread Rate Thread ? So I still dont see the marked as solved? Thank you.

It seems there is some problem as even i don't see any "solved" option in my thread. I will request the moderator to look into this. :)

newbie14 02-09-2012 01:10 AM

Dear Deepak,
Yes I cant see the word solved any where either. Thank you.


All times are GMT -5. The time now is 11:30 PM.