nodejs、vue、ssh服务、ssh免密登录

   27  yum -y install eple-release.noarch

   28  yum -y install epel-release

   29  yum -y install sl

   30  sl

   31  yum -y install nginx

   32  which nginx

   33  yum list|grep nodejs

   34  yum -y install nodejs.x86_64

   35  node -v

   36  yum -y install npm

   37  npm -v

   38  npm config set registry https://registry.npmmirror.com

   39  npm install @vue/cli -g

   40  find / -name "vue"

   51  touch /root/node

   52  /root/node modules/.bin/vue -V

   53  chmod +x /root/node

   54  /root/node modules/.bin/vue -V

   55  /root/node modules/.bin/vue create vuehtm1000

在当前目录创建vuehtm1000目录,程序员就可以在这发前端页面

选第三个按回车,跳到该界面

光标指到,按空格键

然后一直按回车,等待

Tree vuehtml000/

启动前端项目 进入到项目的目录 cd vuehtml000/

执行:npm run serve

提供了两个访问方式192.168.119.55:8080

关闭防火墙

Fg回去    ctrl+C切换界面、退出服务

启动nginx:nginx -s reload

ssh两种认证方式

  1. 基于用户名密码认证

JumpServer => ssh code@RealServer的IP地址

  1. 基于密钥对的认证

基于密钥对认证,也就是所谓的免密码登录,理解免密登录原理:

任务解决⽅案

1. 跳板机上的开发⼈员⾃⼰⽣成⼀对秘钥

code1为例:

[code1@MissHou ~]$ ssh-keygen

Generating public/private rsa key pair.Enter file in which to save the key (/home/code1/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/code1/.ssh/id_rsa.

Your public key has been saved in /home/code1/.ssh/id_rsa.pub.

The key fingerprint is:

14:78:f6:70:9f:48:64:7e:19:c3:cb:c3:7a:52:1e:d8 code1@MissHou.itcast.cc

The key's randomart image is:

+--[ RSA 2048]----+

| ...o.o |

| . ++o .+ |

| o.=.Boo |

| . +.E |

| S + o |

| o o |

| o |

| |

| |

+-----------------+

[code1@MissHou ~]$ ll -a .ssh/

total 16

drwx------ 2 code1 coding 4096 Dec 28 09:33 .

drwx------ 5 code1 coding 4096 Dec 27 11:49 ..

-rw------- 1 code1 coding 1675 Dec 28 09:33 id_rsa

-rw-r--r-- 1 code1 coding 405 Dec 28 09:33 id_rsa.pub

2. 将code1⽤户的公钥远程拷⻉到⽣产服务器上指定⽤户的指定⽬录

[code1@MissHou ~]$ ssh-copy-id code@10.1.1.1

The authenticity of host '10.1.1.1 (10.1.1.1)' can't be established.

RSA key fingerprint is 30:c8:1a:67:55:22:33:26:e5:fb:44:56:4d:8b:26:40.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '10.1.1.1' (RSA) to the list of known hosts.

code@10.1.1.1's password:

Now try logging into the machine, with "ssh 'code@10.1.1.1'", and check

in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

或者

[code1@MissHou ~]$ scp -P22 ~/.ssh/id_rsa.pub

code@10.1.1.1:/home/code/.ssh/authorized_keys

code@10.1.1.1's password:

id_rsa.pub

3. 测试验证

[code1@MissHou ~]$ ssh -lcode 10.1.1.1

Last login: Fri Dec 28 09:38:17 2018 from 10.1.1.250

[code@server ~]$

远程管理SSH服务

搭建SSH服务

在配置文件中设置permitrootlogin no  不允许root账户远程登陆  可以设置其他用户远程登陆

 27  rpm -ql openssh

   28  ls /etc/ssh/

   29  vi /etc/ssh/sshd_config

PermitRootLogin no      38行yes改成no

   30  systemctl restart sshd

选项

ssh连接服务器,如果服务端口是22,可以不用添加-p选项

如果不是22端口,就不许添加-p

[root@es-002 ~]# yum -y install pwgen

[root@es-002 ~]# pwgen -cnBs1 10 1     //生成随机密码(密码长度是10生成一个)

P49he3NNzq

[root@es-002 ~]# pwgen -cnBs0 20 10     //密码长度是20生成10个(0是不换行1是换行)

YuHTVJAyVRvhLefVpWNk zLdtVpmPHAAYEeEonvoF odqxbsENHJubKHdpfzwA

eJLKLFywUqFEpqdHYkTu bJbfCTyJkWRhwKYdTLqb HRCPxeyWrHzspekVWFeV

cphgJJKgmtYJKxPxNdEd gupwjFyMdVgfWvWUFHHw aTqjiNNVdJzJLavPkWwx

EufbNbqVMuyWktrghUVJ

Scp指定端口-P大写

Ssh指定端口-p小写

默认端口22不需要指定

Scp上传也要注意用户的权限问题  没有权限的目录无法上传

     

  • 24
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值