Page 1 of 1
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 12:10 pm
by fulburncams
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
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 12:13 pm
by spurious
Google: linux debian sudoers
you will get plenty of valid results :)
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 1:20 pm
by croston
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.
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 1:34 pm
by fulburncams
That seems to work, many thanks
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 1:51 pm
by ukscone
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
]
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 2:00 pm
by fulburncams
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
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 3:41 pm
by ukscone
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
Re: Just Created New Account but not able to 'sudo'
Posted: Fri May 04, 2012 4:15 pm
by jojopi
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"