How to create a SUDO user in linux and Login without password

1. Server Config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# create a user
sudo useradd XXX

# config sudo, if you cannot open it or save it, please use root user open "sudoers" file
sudo vim /etc/sudoers
# add line like that
# XXX ALL=(ALL) NOPASSWD: ALL

# if your user shell is not bash, please change this line
sudo vim /etc/passwd
# modify /bin/sh to /bin/bash
# XXX:x:1002:1002::/home/XXX:/bin/sh
# ->
# XXX:x:1002:1002::/home/XXX:/bin/bash

# login XXX
sudo su XXX

# to ~ folder, if don't have /home/XXX, please make dir by youself
cd ~

# create .ssh
sudo mkdir .ssh

# create key file
sudo vim authorized_keys
# copy you public key in it
# public key like that: ssh-rsa AAAA...

# Done

2. Client Config

```bash

3. Normal Issue

2024-01-02

⬆︎TOP