I am a new Ubuntu user and am still getting used to the OS. I have been using it primarily for local testing of a site that I am developing. I downloaded the LAMP stack for this.
When I first downloaded Ubuntu, whenever I edited the files I was developing, I needed to enter sudo nano filename
. It was not like this for files in my home directory, only for files where I was testing.
When I logged on today, I didn't have to enter sudo
, I was able to just enter nano filename
and edit the files. I am not sure if I somehow disabled the need for a sudo
password, which I would not want to do.
I ran grep root /etc/passwd
then grep root /etc/shadow
which denied access without entering sudo
. When I did, root:!
showed.
From what I read, that means the account is disabled.
I don't know if that means I disabled the password or if the account is locked and everything is ok.
Is there a way to make sure that I am not running as root and if I currently am how to disable it so I am running only as admin.
Also, why did the sudo
password suddenly stop needing to be entered for editing my files?
Thanks for your answers, if my question is unclear, please let me know so that I can try to clarify.
Best Answer
If you are using bash (the default), your prompt will tell you if you are acting as root. If it ends in a '
$
' you are running as a normal user. If it ends in a '#
' you are running as root.Additionally,
will show who you are.
If you can suddenly edit files that used to require sudo access, my first suspicion would be that you've somehow managed to change the permissions on a file. If you type:
and examine the results, the rwx sections show permissions.
If you belong to a group that has write permissions or if "other" has write permissions then you don't need sudo access to write to the file.
You can read an introduction to linux permissions for more details on file permissions.