User avatar
fulburncams
Posts: 70
Joined: Wed Nov 30, 2011 8:29 pm

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 12:10 pm

A very basic query,  I have just created a new account using 'sudo adduser newaccount' on the RasPi and it has created the account but when i access the new account i cannot use sudo. How can i fix this,  I notice that the pi account is a member of a number of groups,  is it just a case of adding my new account to the groups file ?  Is there an easy way to make the account have the same set-up as the base pi account ?

Regards

Steve

spurious
Posts: 343
Joined: Mon Nov 21, 2011 9:29 pm

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 12:13 pm

Google: linux debian sudoers

you will get plenty of valid results  :)

User avatar
croston
Posts: 706
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 1:20 pm

1. Log in as pi
2. sudo visudo
3. Look what has been done for user pi and copy it for the new user. I think that the group "wheel" is designed as a group for sudo access

If you end up with an editor you can"t figure out, change it first using
export EDITOR=/usr/bin/nano

All of this is from memory as I"m not in front of my computer at the moment - excuse me if I"ve missed anything subtle.

User avatar
fulburncams
Posts: 70
Joined: Wed Nov 30, 2011 8:29 pm

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 1:34 pm

That seems to work,  many thanks

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4214
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 1:51 pm

if you can get a root prompt (either existing sudoable user or you have a root passwd set) another way to do it is to run the command below as root.

usermod -a -G sudo username

[explanation of the command:-

usermod = modify user account settings

-a = append to the existing settings

-G = group setting

sudo = group to add to the user

username = replace with the username that you want to modify

]

User avatar
fulburncams
Posts: 70
Joined: Wed Nov 30, 2011 8:29 pm

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 2:00 pm

Ok,  I just tried that and it responds 'group 'sudo' does not exist'.  Is it just as simple as adding a sudo group line into the /etc/group file and re running the command.

Many thanks

Steve

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4214
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 3:41 pm

you'd use the command groupadd http://linux.die.net/man/8/groupadd and then you'd need to edit the /etc/sudoers file (using visudo) to get it all setup correctly. on debian (at least the releases i currently have running) it is all done except for the usermod part, on other distros it may or may not and then just manually editing the sudoers file is less work

User avatar
jojopi
Posts: 3233
Joined: Tue Oct 11, 2011 8:38 pm

Re: Just Created New Account but not able to 'sudo'

Fri May 04, 2012 4:15 pm

ukscone said:


on debian (at least the releases i currently have running) it is all done except for the usermod part


I have the sudo group in my running debian too, but it does not seem to exist in the original 2012-04-19 img file.  So I am not sure how it got created...

croston said:


export EDITOR=/usr/bin/nano

sudo visudo


This does not work because sudo sanitises the environment.  You have to sudo sh -c "EDITOR=/bin/nano visudo".

Or better yet, "sudo apt-get remove joe"

Return to “Beginners”