Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

Debian10 ; SU, repository mirror, locate, time zone settings

Among the initial settings to be made after installing Debian, we will configure the following items.

  • Restricting users who can su
  • Edit Debian repository mirror settings
  • Make locate command available
  • Locale settings
  • Configure time zone settings
  • Update system packages

1. Limit the users who can su

In Debian, the default configuration allows any user to become the root user with the "su" command.
When multiple users are created on the server, if the login information of any one of the users is known, the su command can be used to take away the root user privileges after unauthorized access, so we need to restrict the users who can execute the su command as much as possible.
Therefore, limit the users who can execute the su command as much as possible. Only users who belong to the wheel group can be authorized to execute su.

1.1 Adding users to the wheel group

Create a wheel group with the following command

Run the usermod command to add a user to the wheel group. For example, let's say the user you want to add is example.

Verify that it has been added to the wheel group using the id command.

1.2 Edit the su command configuration file

The configuration file for the su command is /etc/pam.d/su

Now, the example user can use the "su -" command to transition to root privileges.

2. Editing Debian repository mirror settings

The repository mirror configuration file is /etc/apt/sources.list, make a copy and edit it.

The file contents are

#deb cdrom:[Debian GNU/Linux 10.2.0 _Buster_ - Official amd64 NETINST 20191116-09:56]/ buster main

deb buster main
deb-src buster main

deb buster/updates main
deb-src buster/updates main

# buster-updates, previously known as 'volatile'
deb buster-updates main
deb-src buster-updates main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

The top one is the media we used during the installation. Since it is not used anymore, I have commented it out.
If you want to use it in Japan, make it a mirror with jp.

3. Make the locate command available

The find command can be used to search for a specific file on the entire Linux system, but the options for find are somewhat confusing.
The locate command is capable of extracting all files with the specified file name.
Although it requires you to create a database of file and folder names in advance, it has the advantage of fast file search and ease of use. In this section, we will enable the "locate" command to be used.

3.1 Install the locate package

If you see the name of the locate package in the execution result as shown above, the installation is complete.

3.2 Create a database

3.3 Run the locate command.

s an example, we will search for all files named "sshd".

A list of filenames containing sshd is now displayed.

4. Locale settings

This is the language setting for your Linux system, and if you selected Japanese as the locale when you installed Debian, then you are already in a Japanese environment and do not need to change it.
If your environment is set to English locale and you prefer Japanese locale, please do so.

4.1 Check the current locale.

Check the locale set in the system. To check the locale, use the "localectl status" command.

In the above case, "C.UTF-8" is the locale, which means it is the C locale (POSIX locale).

4.2 Change to Japanese locale

In Debian, you can check the list of locales with the command "localectl list-locales". Let's run it to see the locales available on the system.

Two locales are now displayed. The displayed result "ja_JP.utf8" is the locale for Japanese, so we will set the "ja_JP.utf8" locale.

To set the locale, use the "localectl set-locale" command. Execute it as follows


We have confirmed that the "ja_JP.utf8" locale has been set as shown above.

5. Setting the time zone

In most cases, the time zone of Debian 10 is set at the time of installation, but if the Japanese time zone "JST" is not specified, you can change it with the "timedatectl" command.

5.1 Display the current time zone

To check the time zone set on the server, run the "timedatectl status" command

The time zone is set to "Asia/Tokyo (JST)" as shown above.

5.2 Change time zone to Japan

If the time zone is not set to "Asia/Tokyo (JST)", you can use the command "timedatectl set-timezone" to change the time zone.

I'll check it out.

6. Update the system package

A Debian system installed from the media may contain outdated packages. Debian also uses "apt" to update all packages.
If you do not want to update the packages, but just want to see the list of packages that will be updated, you can run the "apt update" command. You can do this as follows

To update the package, run the "apt upgrade" command.

No update was done this time because there were no packages to update.