DebianThis forum is for the discussion of Debian Linux.
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 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 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.
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:
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.