need:
I got the boss's server account ssh [email protected]. I need to log in to the boss's account, and then create an account for myself to realize ssh <user_name>@172.16.1.100 login.
I hope my account has 1. Sudo permissions, 2. The home directory has a large space.
(The boss, <user_name> and 172.16.1.100 addresses are all false.)
Table of contents
-
01 Create a new user
- 1 Confirm the location of the large-capacity disk
- 2 Create a new user and specify the Home directory
- 3 Set user password
- 4 Grant new user sudo permissions
- 5 Test login
- 02 Follow-up work of configuring the environment
01 Create a new user
1 Confirm the location of the large-capacity disk
df -h # Check the disk space of the file system and confirm the large-capacity partition mount point
Specifically:
- df is the abbreviation for "disk free" and is used to report the disk space usage of the file system.
- The -h option means displaying disk space in a human-readable format (such as KB, MB, GB), rather than in bytes.
After running the df -h command, you will see an output similar to the following:
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 2.4M 1.6G 1% /run
/dev/sda1 233G 50G 173G 23% /
tmpfs 7.8G 124M 7.7G 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sdb1 917G 200G 667G 22% /mnt/data
tmpfs 1.6G 0 1.6G 0% /run/user/1000
The meaning of each column is as follows:
- Filesystem: Filesystem name.
- Size: Total size.
- Used: The space used.
- Avail: Available space.
- Use%: Disk space usage.
- Mounted on: Mounted point.
2 Create a new user and specify the Home directory
# Suppose we want to create the home directory under /data
sudo useradd -m -d /data/<user_name> -s /bin/bash <user_name>
in,
- -m: Automatically create the Home directory (if the parent directory/data exists)
- -d: Specify the custom Home directory path
- -s: Set the default shell to bash
3 Set user password
sudo passwd <user_name>
# Enter the new password twice as prompted
4 Grant new user sudo permissions
sudo usermod -aG sudo <user_name>
Verify directory permissions:
sudo chown -R <user_name>:<user_name> /data/<user_name> # Make sure the directory belongs correctly
ls -ld /data/<user_name> # Check permission should be drwxr-xr-x
5 Test login
ssh <user_name>@172.16.1.100
# Verify after entering your password:
pwd # should display /data/<user_name>
df -h . # Check the space of the partition where the current directory resides
If login fails, check /etc/ssh/sshd_config to ensure that password authentication is allowed (PasswordAuthentication yes), or set the <user_name> user's ssh key directly in the boss user.
02 Follow-up work of configuring the environment
- Set up the ssh key to log in, and you can log in to the server without entering the password:Linux · ssh | How to use ssh keys to log in to a Linux server without password
- Install conda:Conda | How to install conda on Linux server ,Conda | How to install miniconda on Linux server
- Configure git and GitHub access:Git | How to configure git on a new server
- Configure the proxy:Python · GitHub · Linux | Use native as proxy server
- Install MuJoCo, mujoco_py:Python · MuJoCo | MuJoCo corresponds to the version of mujoco_py, and installs Cython
- Create a new conda environment: conda create --name <env_name> python=3.8
- Install dm_control and other libraries:Python · Jax | Install jax on python 3.8 and run offline RL IQL