Results 1 to 7 of 7
When I type visudo as root in console, it opens up, a sudoers.tmp nano screen. The tmp, ending confuses me, is this the screen where I uncomment as needed ? ...
- 07-26-2011 #1Linux Newbie
- Join Date
- Aug 2009
- Posts
- 156
Not sure where to start with Visudo
When I type visudo as root in console, it opens up, a sudoers.tmp nano screen. The tmp, ending confuses me, is this the screen where I uncomment as needed ? I have a log viewer program that I would like to view as regular user, but I get permissions denied. So, that is what I am hoping I can change with visudo. Also is this the screen, where I type visudo commands to change settings? Frank
- 07-27-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,818
Yes, visudo is opening up a temporary copy of /etc/sudoers, so that it can check the syntax for typos after you're done editing it. Then it saves it to /etc/sudoers when it has confirmed that.
Say the command you are using to view the log is tail and say the log you are talking about is /var/log/messages, and say your username is frank - then you might insert a line like this, in visudo:
Code:frank ALL = (root) NOPASSWD: /usr/bin/tail /var/log/messages
- 07-27-2011 #3Linux Newbie
- Join Date
- Aug 2009
- Posts
- 156
That line would be inserted in /etc/sudoers.tmp? If so where , bottom, any white space? Would I need to uncomment any lines in /etc/sudoers.tmp? Thanks for your quick reply, Atreyu
I later entered at the bottom of sudoers.tmp the line you suggested and did not get any error messages. To run the graphical application log file viewer, with root privileges, what sudo command do I type? I have opened nautilus before with gksudo, would this work in a similar way?Last edited by frank56; 07-27-2011 at 09:14 AM.
- 07-27-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,818
Just to be clear, you'd have to run visudo (as root) and let IT create suderos.tmp. The visudo program should load the tmp file in your default editor (I think you said nano). Then you'd use the nano commands to insert a new line at the bottom of the file, then save and quit nano. Then the visudo program will move the tmp file into place (to /etc/sudoers).
The command you'd run as 'frank' would be:
In your bash profile (~/.bashrc) you could put something link:Code:sudo /usr/bin/tail /var/log/messages
Code:alias taillog='sudo /usr/bin/tail /var/log/messages'
Last edited by atreyu; 07-28-2011 at 12:18 PM.
- 07-28-2011 #5Linux Newbie
- Join Date
- Aug 2009
- Posts
- 156
What does putting the alias taillog line in bashrc do, or what is it purpose?
- 07-28-2011 #6Linux Guru
- Join Date
- May 2011
- Posts
- 1,818
Sorry, forgot to explain - that would create (via Bash's builtin alias function) a command, "taillog", that your user could run on the command line, to tail the log, instead of doing the whole sudo line. i.e., instead of:
You could just do:Code:sudo /usr/bin/tail /var/log/messages
It's not required or anything, just a common shortcut that many people do for sudo commands they have to run a lot.Code:taillog
EDIT: My alias statement was incorrect in the other post (was missing the sudo part, duh) - fixed it
- 07-28-2011 #7Linux Newbie
- Join Date
- Aug 2009
- Posts
- 156
Thanks, Atreyu, you have made learning Gentoo fun, or a part of it. I can use all the shortcuts, I can get my hands on.


Reply With Quote

