LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-02-2011, 11:05 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
visudo - I cannot understand it.


I need to add a user to the sudoers in my vps host and edit a couple of files and I just cannot make sense of visudo, vi or nano. The tutorials I find on the net just take too long to study and they are never complete, can someone explain what I need to do?

I am running Debian 506.

Thank you for your help.
 
Old 05-02-2011, 11:12 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
and edit a couple of files
Which files?
http://www.gratisoft.us/sudo/man/1.7.5/visudo.man.html
Should explain visudo.

Kind regards
 
1 members found this post helpful.
Old 05-02-2011, 11:15 AM   #3
droyden
Member
 
Registered: Feb 2007
Location: UK
Posts: 150

Rep: Reputation: 19
What sudo permissions do you want to grant the users?
 
1 members found this post helpful.
Old 05-02-2011, 03:04 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by rblampain View Post
I need to add a user to the sudoers in my vps host and edit a couple of files and I just cannot make sense of visudo, vi or nano. The tutorials I find on the net just take too long to study and they are never complete, can someone explain what I need to do?
I don't understand your question. Are you confused about how tio use vi or nano, or abotu the sudoers file syntax?

Note that visudo is not an editor, what it does is it launches the editor in the EDITOR environment variable (or vi, if $EDITOR doesn't exist), lets you edit the file, and then when you exit the editor it makes sure the syntax is valid before saving it.
 
1 members found this post helpful.
Old 05-02-2011, 05:02 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
By using visudo you can be sure that the file will be locked correctly when you are editing it and it will check for basic syntax errors.

You can change what editor is actually used (it seems it is using nano for you) by setting the EDITOR environment variable. For example if you wanted to use gedit (this should not be taken as a endorsement of this editor) you could do the following:
Code:
EDITOR=gedit visudo
HTH,

Evo2.
 
1 members found this post helpful.
Old 05-02-2011, 05:30 PM   #6
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,884
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Nano editor tutorials - http://www.debianadmin.com/nano-editor-tutorials.html

Nano manpage
http://www.debianadmin.com/manpages/nanomanpage.txt

visudo(8): edit sudoers file - Linux man page - http://linux.die.net/man/8/visudo

Allowing Limited Sudo Access With Visudo | Ubuntu Tutorials - http://ubuntu-tutorials.com/2007/03/...s-with-visudo/

How to configure Sudo to run programs as a different user - NewbieDOC - http://newbiedoc.berlios.de/wiki/How...different_user
 
1 members found this post helpful.
Old 05-03-2011, 03:26 AM   #7
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
Thank you all, I needed to add the main user to the sudoer file with full permissions and edit a few configuration files on the vps. I found just enough info to insert/edit and save the files which is all I needed. There is no point trying to remember what I've learned because, not using it every day, I will have forgotten by the time I use vim again on the VPS host (my local machine uses nano).
 
Old 05-03-2011, 04:44 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Glad you solved your problem. Have you considered keeping notes, so that next time you can refer back to them and save yourself some time?

Cheers,

Evo2.

---------- Post added 2011-05-03 at 18:44 ----------

Glad you solved your problem. Have you considered keeping notes, so that next time you can refer back to them and save yourself some time?

Cheers,

Evo2.
 
Old 05-03-2011, 05:31 AM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by rblampain View Post
Thank you all, I needed to add the main user to the sudoer file with full permissions and edit a few configuration files on the vps. I found just enough info to insert/edit and save the files which is all I needed. There is no point trying to remember what I've learned because, not using it every day, I will have forgotten by the time I use vim again on the VPS host (my local machine uses nano).
Just put the line
Code:
export EDITOR="nano"
into the file /etc/profile, this will make nano the default text editor in your system, so that visudo will use that instead of vi.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
visudo: busy try again later shariefbe Linux - Newbie 4 12-23-2009 11:52 AM
visudo question walidaly Linux - Software 5 05-23-2007 08:59 AM
visudo noonmid27 Linux - Newbie 8 02-23-2007 04:42 PM
Need help with visudo powadha Debian 2 12-19-2004 05:04 AM
visudo xviddivxoggmp3 Slackware 7 08-17-2004 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration