Linux basic knowledge 1

Although I have introduced the commands so far, I will explain a little about Linux itself. The OS selected by default for Sakura's VPS is CentOS. CentOS is one of the Linux distributions.

You can think of a distribution as something that can be distributed by adding functions on Linux so that users can use it easily.

CentOS | Ubuntu
  Linu kernel

The Linux kernel is the core part of Linux, and there are Linux distributions with additional functions on it. There are Linux distributions such as CentOS and Ubuntu.

File owner

Let's display the file in detail with ls as follows.

ls -l

Then, it will be displayed as follows.

-rw-rw-r-- 1 kimoto project 588  Jun 16 13:19 README
drwxrwxr-x 3 kimoto project 4096 Jun 16 16:39 lib

kimoto represents the owner of the file. In other words, the file called README is considered to be owned by user kimoto.

project represents the group that owns the file. In other words, the file called README is considered to be owned by the group project. The group name will be the same as the user name, especially if it does not belong to a group. The display will be as follows.

-rw-rw-r-- 1 kimoto kimoto 588 Jun 16 13:19 README

Add user

Here, I will explain how to add a user again. You must have root privileges to add users. So let's work as root.

su -

Use the useradd command to add a user.

useradd ken

After adding a user, set a password as well. Use the passwd command.

passwd ken

You will be asked to enter the password and re-enter it for confirmation, so set it.

You can check the list of users by looking at the /etc/passwd file.

cat /etc/passwd

Create group

You can also create a group with any name. Use groupadd to create a group.

groupadd someproject

Users can belong to a group. To add a ken to the someproject group:

You can check the created group in the configuration file /etc/group.

cat /etc/group

Let's make the user owned by the group. Use usermod . You can add users to the group with the -G option.

usermod -G someproject ken

Now user ken belongs to the group someproject.

Users can belong to multiple groups, and multiple users can belong to a group.

Associated Information