Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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 wanted to know when is it necessary to log in as root in a Linux system, can anyone explain to me because I'm a newbie in Linux. I don't really understand about Linux because this is my first time using Linux in my VMware.
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444
Rep:
Is this a homework question?
Anyway I think you will need to log in as root whenever you need to make changes to your system. I mean changes on the file system, users groups, installing or removing applications. for a regular session you can just log in as user and enjoy browsing away or watching videos or whatever.
no, I really wanna know coz I just install Linux in Vmware and I register to main user in root but it say that I should make another user and sign in to root user not the home user....thats y I'm confuse.
The root user is only used for system maintenace, like installing programs, updating the system or changing system-wide configurations. For normal use you should always use an unprivileged user.
Distribution: OpenSUSE 13.2 64bit-Gnome on ASUS U52F
Posts: 1,444
Rep:
Yeah you should create a user and log in as user for most of your session, just because it is really easy to mess up your system if you are logged in as root all the time.
Simple answer:
root is used to change files/dirs (or run programs that can change files/dirs) that affect more than just yourself. A regular user can do anything they want to their own files/settings, but as soon as they try to do something that would affect other users on the system, they're blocked. root is the only one that can get past this restriction and make global changes to the system (ignoring complicated group setups and custom permissions, etc).
More accurate answer:
Regular users must abide by the permissions of any files/dirs on the system. Each file has an owner and a group, and read/write/execute permission flags for the owner, other members of its group, and "everyone else". A regular user will only be able to read that file if they are the owner and the read flag is set for the owner, or if they're a member of the same group as the file and the read flag is set for the group, or if the read flag is set for "everyone else". Same goes for write and execute. If the flag isn't set, the user can't do anything about it (the only exception is that if the file is owned by the user, the user/owner can modify the permissions as they wish).
Root does not have to abide by the permissions of the files/dirs. Root can do anything it wants, it can read files belonging to somebody else, it can delete global system files that don't have write permission, etc. On the computer, root is god.
So to answer your question, root is used whenever your regular user doesn't have the permission to do what needs to be done. Whether that's changing a system config file, restarting a service, reformatting a hard drive, adding/deleting user accounts, etc.
Last edited by suicidaleggroll; 10-16-2013 at 01:05 PM.
Most distros are tying to get users to stop logging in as root. All OS's should have been doing that from the start.
It may be still best to use a user with the least amount of privileges at all times. When some action that requires higher privileges then one can sudo to root or even su to a user that has the required access.
You'd su or sudo from a terminal or some gui's that have been made to run from some admin user and requires a root password.
From a best practice point of view, you reduce exposure as much as you can. Exposing your system to a level with unlimited rights could present a security issue. Behind scenes programs could take advantage in this instance.
Still I get lazy and run su. Some distro's may have broken apps and I may need to actually log on to a root user once in a great while.
I understand that you may user for windows before.
it is easy to think that when you log in as administrator on windows, windows not warn you
so you can easily install-delete all software or change the system files.
but when you are newbie on linux , Linux will warn you that when you log in as root user
you may change the system file without intention.
Running as root also has the security risk that any malware can wind up anywhere on the system, because it's all accessible. You're not likely to get malware on Linux, but if ever you did, it's nice to know that it can't escape from /home!
I'm about a year into a dual-boot system (Win7 & Zorin 6.0) with the intention of leaving Winders behind forever now that I'm retired. I'm still getting my feet wet with Linux but in my experience you WILL need to do a few things as root. After wasting too much of my time when Linux would prevent me from opening particular files and folders (NOT system files, just files and folders I use in the normal course of a computing session) I taped a piece of paper to the bezel of my PC monitor that reads "root = gksudo nautilus." Typing that at the command line (or "bash" or whatever it is called in Linux) I can now quickly change the permissions of files and folders. So, I don't need a separate log-in account for root. The experts will caution you against running as root all or even most of the time and that is good advice. But I would rate the numerous occasions when Linux prevented me from opening files and folders because of the permissions issue, as one of the top three frustrations I've had with this new operating system. But I love it and enjoy the learning experience!
Something wrong again....maybe this is stupid question but how to solve problems created by a superuser
Depends on what was done. Somebody who doesn't know what they're doing as root could easily destroy a system to the point of needing to wipe it and reinstall from scratch.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.