LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 05-07-2013, 09:48 PM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Rep: Reputation: Disabled
creating/adding new user to system


I would like to add a new user to the system. There are a few things though that must be done:

1) they must be part of a certain group
2) they must have the specified home folder

here is my code:

Code:
sudo adduser --groups ftpaccounts --home /home/user/testuser
I get the error: Unknown option: groups.

I also tried just group, but then it tells me that "the group, 'ftpaccounts' already exists'" (this group does exist already). What am I doing wrong?

EDIT: now that I think of it, this user probably doesn't even need a home directory if they are just uploading files.

Last edited by sniper8752; 05-07-2013 at 09:59 PM.
 
Old 05-07-2013, 10:06 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

are you sure the version of adduser you are using has a "--groups" option? I suggest you read the man page. Anyway, a bigger problem seems to be that you did not specify the user (which is a mandatory parameter).

Evo2.
 
Old 05-07-2013, 10:11 PM   #3
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
oh yea that may help. I think I meant to have a space in there.

here is what I get now:

sudo adduser --group ftpaccounts --home /home/user/ testuser
adduser: Specify only one name in this mode.
 
Old 05-07-2013, 10:14 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

seems you did not read the man page. On my system, the man page indicates that the --groups option is is only valid when using --system (which presumably is not what you want). Perhaps what you want is --ingroup.

Evo2.
 
Old 05-07-2013, 10:26 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Why not simply use useradd: http://linux.die.net/man/8/useradd
Code:
~# useradd --group <groupname> -m --home /path/to/home_dir <username>
OR
~# useradd -g <groupname> -m -d /path/to/home_dir <username>
 
Old 05-07-2013, 10:36 PM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by shivaa View Post
Why not simply use useradd: http://linux.die.net/man/8/useradd
Need to be a little careful here, both useradd and adduser can be different on different systems. It's best to read the man pages on the system in use (useradd on my Debian does not have a --group option, and nor does the man page linked to above).

Evo2.
 
Old 05-07-2013, 10:37 PM   #7
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
Why not simply use useradd: http://linux.die.net/man/8/useradd
Code:
~# useradd --group <groupname> -m --home /path/to/home_dir <username>
OR
~# useradd -g <groupname> -m -d /path/to/home_dir <username>
The second one seemed to work for me.

Last edited by sniper8752; 05-07-2013 at 10:42 PM.
 
Old 05-07-2013, 10:42 PM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

Quote:
Originally Posted by sniper8752 View Post
The second one seemed to work for me. I just didn't decide to give them a home folder.
Did you end up reading the man page or did you just proceed by trial and error? I'd like to warn against the later: it can be dangerous running random commands with random options as root.

Evo2.
 
Old 05-07-2013, 10:42 PM   #9
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
I read it, and some of them online as well. Some of it was trial and error to see what worked.
 
Old 05-07-2013, 10:49 PM   #10
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
what's the difference between home-dir and base-dir? is home dir, their home directory, and base-dir, where they are always set by default?
 
Old 05-07-2013, 11:00 PM   #11
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

Quote:
Originally Posted by sniper8752 View Post
what's the difference between home-dir and base-dir? is home dir, their home directory, and base-dir, where they are always set by default?
the fist option listed in the man page...
Quote:
-b, --base-dir BASE_DIR
The default base directory for the system if -d HOME_DIR is not specified. BASE_DIR is concatenated with
the account name to define the home directory. If the -m option is not used, BASE_DIR must exist.
Regarding defaults, also from the man page:
Quote:
/etc/default/useradd
Default values for account creation.
Evo2.

Last edited by evo2; 05-07-2013 at 11:04 PM.
 
Old 05-07-2013, 11:07 PM   #12
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
I am following this tutorial, and am also stuck here:

chown testuser:ftpaccounts /home/user

I tried this, and it did not work for me.

http://knowledgelayer.softlayer.com/...t-within-linux

I looked at the examples at the bottom of this page
http://linux.die.net/man/1/chown

I only got errors like this:

sudo chown ftpaccounts /home/testuser
chown: invalid user: `ftpaccounts'

this one worked though:

sudo chown testuser /home/testuser

Last edited by sniper8752; 05-07-2013 at 11:08 PM.
 
Old 05-07-2013, 11:11 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,371

Rep: Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381
The latter error msg is correct.
You've got group(!) called ftpaccounts, not a 'user'. Your chown cmd num 2 defaults to assuming owner (ie user) if you don't specify what you meant.
 
Old 05-08-2013, 11:36 AM   #14
sniper8752
Member
 
Registered: Oct 2012
Posts: 354

Original Poster
Rep: Reputation: Disabled
Yes- I think what it is doing in the tutorial, is giving the directory permissions to the user and the group.
Are you not able to allow a group access to a home directory? Isn't that what they are esentially doing, with "testuser:ftpaccounts"?
 
Old 05-08-2013, 12:37 PM   #15
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Simply follow this syntax:
Code:
~$ chown <owner>:<group> /path/to/directory
OR
~$ chown <owner>.<group> /path/to/directory
Where owner is username whom you want to make as owner of the directory. Moreoever, use -R flag to change permissions recursively i.e. on file/directories thaat are inside the /path/to/directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
is it legitimate and allowed and can be done to make another user account set uid and gid to null 0 to make another root account with different name and possibly not damage the debian system creating and using that new account BenJoBoy Linux - Newbie 12 01-29-2006 10:02 AM
Adding user creating command not found problem Geetha S R SUSE / openSUSE 3 01-17-2006 07:20 AM
adding user on debian system anjani.78 Linux - Newbie 2 07-18-2005 06:36 AM
what is the command to make a user change their password after creating a new user? naweenio Linux - Newbie 7 01-05-2005 07:07 AM
adding subdirs when creating users funkup Programming 2 08-16-2001 06:26 AM


All times are GMT -5. The time now is 09:15 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration