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 ...
Ravexina's user avatar
  • 55.7k
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: ...
KDEx's user avatar
  • 1,011
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 ...
L. D. James's user avatar
  • 25.1k
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, ...
Jacktose's user avatar
  • 939
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 ...
Zanna's user avatar
  • 70.5k
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 ...
Pawel Debski's user avatar
  • 2,724
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 ...
andrew.46's user avatar
  • 38.1k
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
pipe's user avatar
  • 642
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 ...
Zanna's user avatar
  • 70.5k
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 ...
muru's user avatar
  • 198k
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 ...
Journeyman Geek's user avatar
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 ...
kakabali's user avatar
  • 471
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.
David's user avatar
  • 736
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", "...
Rinzwind's user avatar
  • 300k
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 /...
Florian Diesch's user avatar
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 ...
Pilot6's user avatar
  • 90.1k
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 (...
tinlyx's user avatar
  • 3,230
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.
Ali Dehghani's user avatar
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 ...
Lalit Mohan's user avatar
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 ...
Richard Haddad's user avatar
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.
wbloos's user avatar
  • 331
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 ...
Zanna's user avatar
  • 70.5k
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 ...
heemayl's user avatar
  • 91.8k
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 ...
muru's user avatar
  • 198k
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 ...
terdon's user avatar
  • 101k
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 ...
steeldriver's user avatar
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
Neil Hoff's user avatar
  • 301
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 ...
NonlinearFruit's user avatar
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, ...
Aaron's user avatar
  • 6,704

Only top scored, non community-wiki answers of a minimum length are eligible