Photography

Give Yourself The Proper Linux Privileges on Your New Machine

For many of us, the days following the fresh install of a new Linux distribution are like starting your life over. It’s a time for new beginning – new choices for programs, new configurations, new icons. You have a clean slate, and it’s time to explore the possibilities the unknown distro brings with it.


Naturally, you jump on your computer, open up a terminal window, and start throwing out sudo apt-get install commands left and right to play with new applications. But wait: Error messages start flying back saying that you profile is not included as a sudoer.


Well, not exactly. If the first time you attempt to operate as root on a recently installed system and the system spouts back something about your profile not having sufficient privileges to carry out the task, it means that you properly installed the distro.


The fact is that you (probably) do not want to be operating as supervisor all the time. It can be dangerous, and far too often it leads to system meltdowns at the worst possible times. While not having to insert a password before any administrative task can be helpful a lot of the time, using root as a primary account leaves your computer exposed to user stupidity – and plain dumb mistakes happen to the best of us.


sandwich


Ok, so you don’t want to be root all the time, but you obviously need to be able to carry out administrative tasks from time to time – like when you want to do something as simple as installing a new program. So how do you add your profile to the sudoer file?


It’s actually very easy. First, open up a terminal window (probably the one that yelled at you for having insufficient privileges in the first place). For this tutorial let’s pretend your username is alpha, so every time you see alpha substitute in your general user profile. Go ahead and type is “su” on the first line and hit enter. You will be prompted for your password – go ahead and supply it.


linux console


Next, you need to give yourself permission to edit the sudoers file. Type



  • chmod +w /etc/sudoers


Then click enter again. Now you can go in and add yourself to the list. Type



  • echo ‘alpha ALL=(ALL)’ >> /ect/sudoers


And then go ahead and click enter again. Congratulations, you’re now on the list. Before we leave, we want to reset the permissions of the sudoer file by typing


chmod -w /etc/sudoers


Click enter again, type “exit”, press enter again, and then type “exit” one more time to leave the terminal window. And that’s it! Your profile has now been added to the list of those with administrative privileges.


While it is not a difficult procedure, it is one that is easily forgotten. Once you have given yourself sudo privileges you can give them to other Linux users as well, whether you have multiple profiles set up for other users on your computer or even different profiles for different tasks.


Update:


Edit: A number of people have responded to this post raising very justified concerns about configuring sudo in this manner. While it is perfectly safe if you are careful about every change you make, a mistake in configuring sudo can lead to bad problems down the line. As a safeguard, many people prefer editing the sudo file through the visudo command, which, if sudo has not yet been configured, must be accessed when logged in as root. To do so, login as root, open a terminal and type:


visudo


At the bottom of the new series of characters is a line that reads:


#includedir /etc/sudoers.d


To enable a user full access to sudo, simply type:



  • “insertusernamewithoutquotes” ALL=(ALL) ALL


Press Ctrl+X to exit the program and click Y to save a backup buffer file on your way out just in case things go wrong.


Two ways to address the same problem – This method simply provides a failsafe.


The post Give Yourself The Proper Linux Privileges on Your New Machine appeared first on gHacks Technology News | Latest Tech News, Software And Tutorials.




by Melanie Gross via gHacks Technology News | Latest Tech News, Software And Tutorials » Linux
Give Yourself The Proper Linux Privileges on Your New Machine Give Yourself The Proper Linux Privileges on Your New Machine Reviewed by News Tracker on January 16, 2013 Rating: 5

No comments:

Powered by Blogger.