LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2012, 08:17 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Rep: Reputation: Disabled
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.
 
Old 02-07-2012, 08:22 AM   #2
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
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
 
Old 02-07-2012, 08:24 AM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,355

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
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

Last edited by colorpurple21859; 02-07-2012 at 08:25 AM.
 
Old 02-07-2012, 09:34 AM   #4
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
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?
 
Old 02-07-2012, 03:30 PM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
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/

Last edited by Satyaveer Arya; 02-07-2012 at 03:33 PM.
 
1 members found this post helpful.
Old 02-07-2012, 10:08 PM   #6
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by newbie14 View Post
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
 
1 members found this post helpful.
Old 02-08-2012, 12:47 AM   #7
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
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?
 
Old 02-08-2012, 12:56 AM   #8
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
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"

Last edited by deep27ak; 02-08-2012 at 01:07 AM.
 
1 members found this post helpful.
Old 02-08-2012, 12:19 PM   #9
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Deepak,
Where is the solved button?
 
Old 02-08-2012, 12:41 PM   #10
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
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"
 
Old 02-09-2012, 12:50 AM   #11
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-09-2012, 01:03 AM   #12
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by newbie14 View Post
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.
 
Old 02-09-2012, 01:10 AM   #13
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Deepak,
Yes I cant see the word solved any where either. Thank you.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] user postgres does not exist idrissess Linux - Newbie 21 07-21-2010 11:47 AM
gdm user does not exist tulsi Linux - Newbie 1 11-05-2009 09:35 AM
/home/user/%U does not exist Sky535 Linux - Newbie 10 03-03-2009 09:08 AM
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 10:52 PM
su: user does not exist sdem Linux - Software 3 03-11-2006 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:04 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