服务器方案新增用户root@xjTEST:~/.ssh# adduser kingAdding user `king' ...Adding new group `king' (1001) ...Adding new user `king' (1001) with group `king' ...Creating home directory `/home/king' ...Copying files from `/etc/skel' ...New password:Retype new password:passwd: password updated successfullyChanging the user information for kingEnter the new value, or press ENTER for the defaultFull Name []:Room Number []:Work Phone []:Home Phone []:Other []:Is the information correct? [Y/n] Yroot@xjTEST:~/.ssh#
赋予root权限$ chmod 700 /etc/sudoers$ vi /etc/sudoers# User privilege specificationrootALL=(ALL:ALL) ALL下边增加kingALL=(ALL:ALL) ALL$ chmod 400 /etc/sudoers
生成密钥对root@xjTEST:~/.ssh# cd /home/king/root@xjTEST:/home/king# mkdir .sshroot@xjTEST:/home/king# cd .ssh/root@xjTEST:/home/king/.ssh# ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): king_8.134.210.33.pemEnter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in king_8.134.210.33.pemYour public key has been saved in king_8.134.210.33.pem.pubThe key fingerprint is:SHA256:mAa0TRY+kECFCqU6nPfunpWeiRAStvIXnw3dqVz1iS8 root@xjTESTThe key's randomart image is:+---[RSA 3072]----+| o+++.+.||.....B||o+o +.||= +. = . o o . ||+= o. = S + . o||.oo o+ =.o.||....oo+E .||.o = o.||o* +|+----[SHA256]-----+root@xjTEST:/home/king/.ssh# lsking_8.134.210.33.pemking_8.134.210.33.pem.pub
服务器认证证书root@xjTEST:/home/king/.ssh# cat king_8.134.210.33.pem.pub >> authorized_keys
客户端登录把私钥传到客户端,放到~/.ssh
目录中
xiaojin@xiaojin-PC:~/.ssh$ ssh -i ~/.ssh/king_8.134.210.33.pem king@8.134.210.33
好了教程就到这里结束了 。
推荐阅读
- 三星zflip3最新消息_三星zflip3最新消息曝光
- fltp备份文件后统计验证
- iphone已停用怎么刷机不用电脑(iphone已停用不刷机怎么解决)
- 五 RK3568开发笔记:在虚拟机上使用SDK编译制作uboot、kernel和ubuntu镜像
- DNF普通装备上能打红字吗?怎么打(dnf已经洗出来红字了怎么消除)
- 永久解决Ubuntu下adb权限问题
- wifi如何手机上防止别人蹭网(手机wifi已连接但不可上网)
- 奥比岛手游验证猜想第三章要怎么通关
- Android 跨进程渲染
- 有油款 “倩碧黄油”——————真假辨别 上次的兰蔻粉水鉴别方法已经分享过了