Carane nginstal lan ngatur server SSH ing Debian Linux?
Nginstal lan Testing SSH Server
You will need to be root to do the following…
su
-
Instal SSH Server
apt install openssh-server
-
Priksa yen proses server ana. Iki nuduhake nginstal banjur uga.
ps -A | grep sshdoutput (utawa padha):
1753 ? 00:00:00 sshd -
Instal Klien SSH kanggo mriksa sambungan SSH Server
apt install openssh-clientNyambung menyang localhost kanggo nyoba sambungan
ssh localhostUga login nganggo alamat IP antarmuka
Njaluk Alamat IP
ip addrSSH kanggo alamat ip
ssh {ipaddress here}
Nggayuh SSH Server
Iku apike kanggo ngamanake server SSH dening disallowing ROOT kanggo mlebet lan configuring mlebu mung dening i.e tombol umum. mlebu nggunakake sandhi ora diijini
Ensure to execute the following commands as your user and not as root
-
Navigasi menyang direktori ngarep pengguna
cd
-
Priksa yen .ssh ana
ls -a
-
Yen .ssh ora ana, nggawe
mkdir .ssh
-
Nyetel ijin folder kanggo 700
chmod 700 .ssh
-
Nggawe file authorized_keys
touch ./.ssh/authorized_keys
-
Ganti ijin ing authorized_keys file kanggo 600
chmod 600 ./.ssh/authorized_keys
-
Bukak file authorized_keys
nano ./.ssh/authorized_keys
-
Tempel tombol umum menyang berkas
Sampeyan bisa njaluk tombol umum saka klien SSH. Yen klien punika Windows 10 then it will be in the
%USERPROFILE%/.ssh/id_rsa.pubfile. If the client is Debian then the public key is~/.ssh/id_rsa.pub.If your public key does not exist, generate it on the client machine
ssh-keygen -t rsa -C "email@domain.com"
-
Change to root user
su -
Configure your SSH server to accept only public key logins and prevent login for root
nano /etc/ssh/sshd_configUncomment and/or edit the following lines
PermitRootLogin no
StrictModes yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
PasswordAuthentication no
-
Restart the sshd service
service sshd restart
-
Try logging in as root from your SSH client using password
ssh root@{ssh server ip address}output:
Permission denied (publickey). -
Try logging in as username from your SSH client using password
ssh username@{ssh server ip address}output:
Permission denied (publickey). -
Try logging in as root from your SSH client using the public key
ssh root@{ssh server ip address} -i .ssh/id_rsaoutput:
Permission denied (publickey). -
Mlebu minangka jeneng panganggo saka klien SSH nggunakake tombol umum
ssh username@{ssh server ip address} -i .ssh/id_rsa
Yen klien SSH wis alamat IP statis sampeyan bisa uga pengin nimbang Alamat IP Panjenengan saged mlebet ing server SSH.
