mighty2361
Posts: 3
Joined: Sat Mar 16, 2013 12:19 pm

How can I create a new user

Sat Mar 16, 2013 12:23 pm

Hello!

I have a raspberry pi model B with raspbian operating system. I am new to linux and I don't know how to create new users and move them to other groups. Can somebody help me create a new user which has admin permissions? (I can only use command line, because I don't have any spare monitors - I just used one to set up ssh and am now using PuTTY on my Windows computer) Thank you!

User avatar
joan
Posts: 14843
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How can I create a new user

Sat Mar 16, 2013 2:37 pm

Have a look at adduser.

man adduser for the manual

sudo adduser user to actually add a user

sudo adduser user group to add a user to a group

Add an entry in /etc/sudoers similar to the pi entry to allow them administration privileges.

mighty2361
Posts: 3
Joined: Sat Mar 16, 2013 12:19 pm

Re: How can I create a new user

Sat Mar 16, 2013 2:50 pm

joan wrote:Have a look at adduser.

man adduser for the manual

sudo adduser user to actually add a user

sudo adduser user group to add a user to a group

Add an entry in /etc/sudoers similar to the pi entry to allow them administration privileges.
Thank you!

amacater
Posts: 9
Joined: Sun Apr 15, 2012 7:29 pm

Re: How can I create a new user

Mon Mar 18, 2013 12:20 pm

It may also help to login as the original pi user and use the groups command to find out what groups pi is in.

as pi

sudo su -

useradd foo [adds a new user foo, prompts for password and user details]

adduser foo cdrom [adds user foo to group cdrom - repeat for all groups that pi has for the new user]

exit out of that.

Try logging in as the new user - check that the password works.

Login as pi, sudo su - and then run

visudo

which allows you to edit the /etc/sudoers file. Either add a line exactly matching the one for pi or change the name pi to the name of your new user that you have just created.

userdel -r will remove any user and their home directory.

User avatar
yv1hx
Posts: 374
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: How can I create a new user

Wed Jul 31, 2013 4:56 pm

Is important to note that the user standard configuration files are placed in /etc/skel and are copied to the new user home directory upon the creation.

Good luck!
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

bfesser
Posts: 7
Joined: Sun Jan 13, 2013 6:48 pm
Location: MN, US

Re: How can I create a new user

Fri Nov 01, 2013 1:51 am

An informative page on /etc/skel:
http://www.linfo.org/etc_skel.html

User avatar
Benfll
Posts: 6
Joined: Sun May 26, 2013 3:32 pm
Location: Earth!

Re: How can I create a new user

Sat Feb 15, 2014 6:37 pm

joan wrote:Have a look at adduser.

man adduser for the manual

sudo adduser user to actually add a user

sudo adduser user group to add a user to a group

Add an entry in /etc/sudoers similar to the pi entry to allow them administration privileges.
When I do this the users are deleted on every reboot. How can I fix this!? :x Forget that, I was using sudo useradd benjamin instead of sudo adduser benjamin. :oops: Image
Last edited by Benfll on Sat Feb 15, 2014 8:34 pm, edited 1 time in total.

User avatar
Raspruss
Posts: 93
Joined: Thu Jan 23, 2014 3:50 pm
Location: Virginia, USA

Re: How can I create a new user

Sat Feb 15, 2014 7:14 pm

One of the most useful commands to know is apropos. It will tell you what manual entries contain the keyword you specify. You then can use the man command to read the available documentation for the particular command (as noted by the poster replying to you above).

So, for example, you could have done apropos user and one of the gajillion answers would have pointed you to the correct man[ual] pages to read.

thegamingmineblox
Posts: 13
Joined: Sun Dec 27, 2015 4:43 pm

Re: How can I create a new user

Tue Dec 29, 2015 1:41 pm

How i can make him have adminstrator priveleges

SkyRise
Posts: 179
Joined: Tue Jan 24, 2012 1:20 pm

Re: How can I create a new user

Tue Dec 29, 2015 2:48 pm

As mentioned by amacater above:
Login as pi, sudo su - and then run

visudo

which allows you to edit the /etc/sudoers file. Either add a line exactly matching the one for pi or change the name pi to the name of your new user that you have just created.

User avatar
toohoo
Posts: 4
Joined: Sat Feb 04, 2017 11:27 am
Location: Dorfen, Bavaria, Germany

Re: How can I create a new user

Mon Mar 19, 2018 5:54 am

amacater wrote:
Mon Mar 18, 2013 12:20 pm
as pi

sudo su -

useradd foo [adds a new user foo, prompts for password and user details]
.. Does not ask for password and details. Could I do something wrong on this?

Tanks
---[ Thomas Hofmann - @heroold - Dorfen, Bavaria, DE ]---

Return to “Beginners”