Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently installed Squeeze from
[Debian GNU/Linux 6.0.4 _Squeeze_ - Official i386 kde-CD Binary-1 20120128-12:53]
Although there is a 'sudoers' file in '/etc/sudoers' it only contains a "Read Me" file; which is empty.
In order to avoid the necessity of doing routine stuff as root (su) I'd like to start using sudo.
I've read the man pages and done all the searching I can think up, but the literature all seems directed at making changes to a sudoers file, not creating one from scratch. I've also learned that messing up a 'sudoers file' can create serious problems. So I want to be sure I do it right. AFAICT no 'visudo' editor is on my system; either.
This is my personal home desktop and am the only user.
I would appreciate seeing something like a mock example of a single-user sudoers file that I can edit with my particulars.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
What is the output of the following?
Code:
cat /etc/sudoers
If you don't have a sudoers file or visudo (which, as mentioned needs to be run as root) installed then I would suggest there is likely to be a problem.
If you don't have a sudoers file or visudo (which, as mentioned needs to be run as root) installed then I would suggest there is likely to be a problem.
Code:
# cat /etc/sudoers
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
Code:
# visudo -c
/etc/sudoers: parsed OK
Well; there it is b'gosh! It's time like this I seriously doubt I have the chops to be running deb/linux at all.
I fussed a bit with what I could understand from 'man visudo'. I don't know what to do to get an 'editor'(Defaults env_reset ?) or what to modify if I do get one.
So according to your sudoers file sudo is installed and setup on your system. As indicated by
Code:
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
At this point you need to check what groups your username belongs to.
Code:
~ $ id fukawi1
uid=1000(fukawi1) gid=1000(fukawi1) groups=1000(fukawi1),10(wheel)
~ $
If you see the group "sudo" listed there then sudo should work, by using
Code:
$ sudo command
And then entering the users (not roots) password.
If you do not see the "sudo" group listed, you will need to add yourself to that group, by su'ing to root, and running usermod
Code:
# usermod -a -G sudo username
What this does is append (-a) the group (-G) to the username (username).
If you don't have a sudoers file or visudo (which, as mentioned needs to be run as root) installed then I would suggest there is likely to be a problem.
Code:
# cat /etc/sudoers
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
Code:
# visudo -c
/etc/sudoers: parsed OK
Well; there it is b'gosh! It's times like this I seriously doubt I have the chops to be running deb/linux at all. I don't want to start a philosophical discussion I'm not qualified to participate in, but just as an observation, ...expecting a pilgrim penguin like me to assimilate 1362 lines of 'techno-arcana' in the 'sudoers' man page is rather optimistic. 'Yous guyses' seem to treat this like a book report on "Dick and Jane". To the kid here, it's more like presenting a copy of "The Differential CALCVLVS." to a gerbil.
I fussed a bit with what I could understand from 'man visudo'. I don't know what to do to get something I might recognize as an 'editor'(Defaults env_reset ?) or what to modify if I do get one.
As was already mentioned, this line is already set up for you. You need to add yourself to the "sudo" group. You don't need to edit your /etc/sudoers file. It is already configured. So you don't need to learn using vi after all (visudo).
So according to your sudoers file sudo is installed and setup on your system. As indicated by
Code:
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
At this point you need to check what groups your username belongs to.
Code:
~ $ id fukawi1
uid=1000(fukawi1) gid=1000(fukawi1) groups=1000(fukawi1),10(wheel)
~ $
If you see the group "sudo" listed there then sudo should work, by using
Code:
$ sudo command
And then entering the users (not roots) password.
If you do not see the "sudo" group listed, you will need to add yourself to that group, by su'ing to root, and running usermod
Code:
# usermod -a -G sudo username
What this does is append (-a) the group (-G) to the username (username).
Just so you know; I'm experiencing frequent screen freezes that cause hard shut-downs and restarts... and Konqueror isn't 'restoring' even though the option is given. I have to start over from scratch which has made posting here a PITA.
OK, here goes:
Code:
~$ id fukawi1
id: fukawi1: No such user
rooster@royrogers:~$ uid=1000(fukawi1) gid=1000(fukawi1) groups=1000(fukawi1),10(wheel)
I entered:
Code:
# usermod -a -G sudo [username]
I again tried
Code:
~ $ id fukawi1
uid=1000(fukawi1) gid=1000(fukawi1) groups=1000(fukawi1),10(wheel)
~$ id fukawi1
id: fukawi1: No such user
rooster@royrogers:~$ uid=1000(fukawi1) gid=1000(fukawi1) groups=1000(fukawi1),10(wheel)cd
bash: syntax error near unexpected token `('
Then I tried:
Code:
~$ id (username)
uid=1000(username) gid=1000(username) groups=1000(username),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev),114(powerdev),115(scanner)
Ok replace any instances of "fukawi1" or "username" within [code][/code] tags, with your username (on the system, not the forum).
I think my post did a reasonable job of explaining itself, and it is fairly obvious that MY username is not going to work on YOUR system, and thus you should change it, which leads me to believe you didnt read the post, and you are just looking for a cut and paste solution to your problem. This is not how LQ works.
Ok replace any instances of "fukawi1" or "username" within [code][/code] tags, with your username (on the system, not the forum).
I think my post did a reasonable job of explaining itself, and it is fairly obvious that MY username is not going to work on YOUR system, and thus you should change it, which leads me to believe you didnt read the post, and you are just looking for a cut and paste solution to your problem. This is not how LQ works.
It's not that I'm not paying attention. An you are definitely doing a reasonable job; especially under the circumstances. All the screen freezes and cold restarts are messing up my ability to post properly. I did insert my username, it's just that I couldn't edit the post to show what I had done in terminal before another freeze. Note: this is the third time I've tried to reply to this post and I'm just going to hit "Submit" without risking the extra "Preview" before I proceed further.
~$ sudo kwrite
[sudo] password for (username):
(username) is not in the sudoers file. This incident will be reported.
WRT your previous suggestion to check what groups my username belongs to.,
Code:
~$ id rooster <snip> ,groups=1000(username),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev),114(powerdev),115(scanner)
I'm not sure if I'm supposed to, but I'm not seeing my (username) associated with ',27(sudo)' even after having entered
Before doing anything else on your machine you should really fix your freezing problems. Open another thread for this problem, so that we can better help you.
If your name is listed after the line beginning with "sudo:" in the /etc/group file, then reboot and try using sudo again. To run a desktop program like kwrite, use "kdesu" instead of "sudo". It woiyrks like sudo but also gives the root user access to your screen.
If your name is listed after the line beginning with "sudo:" in the /etc/group file, then reboot and try using sudo again. To run a desktop program like kwrite, use "kdesu" instead of "sudo". It woiyrks like sudo but also gives the root user access to your screen.
My name is listed in the '/etc/goup' file: "sudo:x:[name]
Testing:
Code:
~$ sudo -V
Sudo version 1.7.4p4
rooster@royrogers:~$ sudo -l
[sudo] password for rooster:
Matching Defaults entries for rooster on this host:
env_reset
User [name] may run the following commands on this host:
(ALL) ALL
Code:
~$ sudo kwrite
[sudo] password for rooster:
No protocol specified
kwrite: cannot connect to X server :0
'kdesu' is what I was used to in Etch and Lenny; ... worked like a charm. However in Squeeze:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.