[The virtual machine does not have permission to use the current user, so create a root account]

1. Problem

When operating with a non-root account, many permission issues may arise
. For example:

mkdir: cannot create directory ‘/data’: Permission denied

You need to be root to perform this command.

At this time, you need to create a root account to perform operations.

2. Create a root account on the virtual machine

1. Log in to the virtual machine and switch to root

Command su to switch to the root account and enter the password

su

Insert image description here

2. Initialize the password of the root account and enter the new password

sudo passwd root

Insert image description here

3. Modify the sshd_config file to enable root access.

sudo vim /etc/ssh/sshd_config

4. Uncomment the Authentication section in the sshd_config file:

Insert image description here

5. You can search by searching keywords

在Linux中的vi、vim编辑模式中查找关键字的方法:
1、进入vi中,编辑模式中先按下键盘上"esc"跳转成命令输入模式
2、输入斜杠"/",这时屏幕会跳转到底部,输入栏出现"/"
3、输入你需要查找的关键字,回车键
4、如果要继续查找下一个关键字,输入n

 :q!  不保存文件,强制退出vi命令  :w   保存文件,不退出vi命令  :wq  保存文件,退出vi命令

Guess you like

Origin blog.csdn.net/m0_49762804/article/details/131977797