117
votes
What is the main difference between chmod and chown?
In simple term
chown is used to change the ownership of a file while chmod is for changing the file mode bits.
chown defines who owns the file.
chmod defines who can do what.
When you make someone ...
91
votes
How to change default user in WSL Ubuntu bash on Windows 10
Now that LxRun.exe is deprecated, if you install Ubuntu from the Windows store the command you will need to run at a windows command prompt is
ubuntu config --default-user <username>
(Note: ...
85
votes
Accepted
What is the www-data user?
For security.
The files are not world writeable. They are restricted to the owner of the files for writing.
The web server has to be run under a specific user. That user must exist.
If it were ...
82
votes
How to change default user in WSL Ubuntu bash on Windows 10
The top answer (ubuntu config --default-user root) is currently correct for the default instance. But if you have multiple instances, you need to work slightly harder:
Inside the instance, as root, ...
74
votes
Accepted
What is the main difference between chmod and chown?
Let's create a file
touch rainbow
Let's have a look at the file's metadata
$ ls -l rainbow
-rw-rw-r-- 1 zanna zanna 0 May 24 10:09 rainbow
The first part of the information is the file type (- at ...
58
votes
Accepted
adding local content in /etc/sudoers.d/ instead of directly modifying sodoers file via visudo
As this question says, /etc/sudoers is a system-wide configuration file that can be automatically changed by system upgrades and is highly fragile to improper changes. You can potentially lose access ...
57
votes
Accepted
How to find which users are currently logged in?
The easiest method to find who is logged on to your system is the use the who command, a part of the gnu coreutils package. It can be used as an ordinary user with no options or with my own favored ...
55
votes
How to find which users are currently logged in?
All of these answers are excessively bloated. Three characters for a command? Please.
The fastest way to find who's logged on and doing what is:
$ w
48
votes
What would happen if I created an account called 'root'?
Usernames must be unique, so, as mentioned by Owen Hines' answer, you wouldn't be able to create this user. However, the key point here is that superuser powers (all possible permissions) aren't ...
46
votes
What is the www-data user?
www-data is the user that web servers on Ubuntu (Apache, nginx, for example) use by default for normal operation. The web server process can access any file that www-data can access. It has no other ...
40
votes
Accepted
How to prevent a new user from doing anything dangerous?
This is as designed. And worse. chmod 777 means... "I'd like the owner, anyone in his group, and anyone at all to have read, write and execute permissions"
Which is pretty terrible.
And for a web ...
37
votes
How to change default user in WSL Ubuntu bash on Windows 10
All other answers were helpful, but can be other scenarios too, follow here as per yours. Mine was Ubuntu 16.04, so I used the following:
ubuntu1604 config --default-user <username>
If you ...
34
votes
How to make user home folder after account creation?
If you forgot to use -d -m, the best and quick option is to run
sudo mkhomedir_helper username
with creates the home directory as if you would have provided the missing options.
34
votes
Accepted
Why is syslog a user?
It has to do with security and permissions on accessing your system.
And no, you have a lot more users than just your own user. There is "root", "daemon","bin", "...
33
votes
Accepted
What is the sandbox user '_apt' on my system
The user _apt is created by the postinst script of the apt package (/var/lib/dpkg/info/apt.postinst):
# add unprivileged user for the apt methods
adduser --force-badname --system --home /...
32
votes
Accepted
Is first Ubuntu user root?
The first user won't be root. The first user will have sudo permissions.
So just install Ubuntu and you'll have exactly what you wanted.
The root user will be created behind the scene, but root login ...
30
votes
How can I preset aliases for all users?
As pointed out here, it's probably better to add global aliases in /etc/bash.bashrc:
alias foo='bar --baz'
alias baz='foo --bar'
, because scripts in /etc/profile.d can be ignored for certain (...
27
votes
How can I find out my user name?
Open a Terminal and type:
echo $USER
This will print the value of USER environment variable to the console.
26
votes
How can I display all users and groups with a command?
Here we are going to use getent for the detailed the info
We can list the user with the following command:
getent passwd
We can list the group as follows:
getent group
To fetch detail a specific ...
23
votes
Ubuntu 20.04 user not listed to login
I had the same issue.
To fix that I did these steps in a terminal:
sudo su we need to be superuser
cd /var/lib/AccountsService/users here we go to the service that shows users, issue is here (at ...
22
votes
Renaming user name
on the server this worked for me:
sudo usermod -md /home/NewHome -l NewName OldName
sudo groupmod -n NewGroupName OldGroupName
This renames the user and its group and also the home folder.
22
votes
Accepted
Can I switch between two users in a single click?
Not a single click, but I can give you a keyboard shortcut solution.
Go into the menu to set custom keyboard shortcuts
and add a new one with this command:
dm-tool switch-to-user suzi
Assuming ...
22
votes
Accepted
Unable to create a user with password via ssh
This is a classic quoting issue.
Problem: Without any quoting or double quoting the command substitution ($()) and variable expansion (the $s in the hashed password returned by openssl are being ...
22
votes
What is the main difference between chmod and chown?
When considering the permissions of a file (or directory, or whatever), there are two factors:
who owns the file - the user and group, and
what they can do with it - read, write, execute or a ...
21
votes
How can one restrict the number of CPU cores each user can use?
While this is possible, it is complicated and almost certainly a bad idea. If only one user is using the machine at the moment, restricting them to N cores is a waste of resources. A far better ...
21
votes
Accepted
Why doesn't the "watch" command work on an alias?
It's nothing to do with users.
Aliases are only expanded in the interactive shell for which they are defined - so an interactive bash shell if you defined them via ~/.bashrc, or an interactive zsh ...
20
votes
Force the user to change their password at first login
Another option would be to expire the password using passwd:
sudo passwd -e username
19
votes
How to edit read-only file in /etc?
If you are editing a file without sudo, and you need sudo in order to save, simply use this vim command:
:w !sudo tee %
Credit to Dr Beco. Note that vim will notice the file change and ask you if ...
19
votes
How to prevent a new user from doing anything dangerous?
Essentially, it breaks down like this:
R = 4 (read)
W = 2 (write)
X = 1 (execute)
So, read permissions only would be 4, read and write would be 6, read and execute would be 5, and all (read, write, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
users × 1526permissions × 379
login × 142
command-line × 115
user-management × 113
sudo × 104
root × 97
server × 89
groups × 89
password × 86
14.04 × 57
12.04 × 55
home-directory × 53
security × 48
adduser × 45
ssh × 44
bash × 43
20.04 × 37
scripts × 31
accounts × 31
samba × 29
directory × 29
mount × 28
login-screen × 28
16.04 × 26