{"id":225942,"date":"2021-09-19T10:22:11","date_gmt":"2021-09-19T02:22:11","guid":{"rendered":"https:\/\/gulass.cn\/?p=225942"},"modified":"2021-09-07T08:39:25","modified_gmt":"2021-09-07T00:39:25","slug":"centos-ssh-rsh","status":"publish","type":"post","link":"https:\/\/gulass.cn\/centos-ssh-rsh.html","title":{"rendered":"\u5982\u4f55\u5728Centos7\u914d\u7f6essh\/rsh\u514d\u5bc6\u4e92\u4fe1\u96c6\u7fa4\u670d\u52a1"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5206\u4eab\u5982\u4f55\u5728Centos7\u914d\u7f6essh\/rsh\u514d\u5bc6\u4e92\u4fe1\u96c6\u7fa4\u670d\u52a1<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

ssh\u514d\u5bc6\u4e92\u4fe1\u64cd\u4f5c<\/strong><\/div>\n
\u4e00\u3001\u5728SSH\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u4e0a<\/strong><\/span><\/div>\n

1\u3001\u4ee5root\u7528\u6237\u767b\u5f55\uff0c\u66f4\u6539ssh\u914d\u7f6e\u6587\u4ef6 \/etc\/ssh\/sshd_config\uff0c\u53bb\u9664\u4ee5\u4e0b\u914d\u7f6e\u7684\u6ce8\u91ca<\/p>\n

RSAAuthentication yes #\u542f\u7528rsa\u8ba4\u8bc1\r\nPubkeyAuthentication yes #\u542f\u7528\u516c\u94a5\u79c1\u94a5\u914d\u5bf9\u8ba4\u8bc1\u65b9\u5f0f\r\nAuthorizedKeysFile .ssh\/authorized_keys #\u516c\u94a5\u6587\u4ef6\u8def\u5f84<\/pre>\n

2\u3001\u91cd\u542fSSH\u670d\u52a1<\/p>\n

systemctl restart sshd  \/\/\u91cd\u542fssh\u670d\u52a1<\/pre>\n
\u4e8c\u3001\u5728\u5ba2\u6237\u7aef\u673a\u5668\u4e0a<\/strong><\/span><\/div>\n

1\u3001\u751f\u6210\u516c\u94a5\u79c1\u94a5\u5bf9<\/p>\n

ssh-keygen -t rsa<\/pre>\n

\u4e00\u8def\u9ed8\u8ba4\u56de\u8f66\uff0c\u7cfb\u7edf\u5728\/root\/.ssh\u4e0b\u751f\u6210id_rsa\u3001id_rsa.pub<\/p>\n

2\u3001\u628aid_rsa.pub\u53d1\u9001\u5230\u670d\u52a1\u7aef\u673a\u5668\u4e0a<\/p>\n

ssh-copy-id -i \/root\/.ssh\/id_rsa.pub 192.168.1.20 #server ip<\/pre>\n
\u4e09\u3001\u91cd\u590d\u4e0a\u8ff0\u6240\u6709\u6b65\u9aa4<\/strong><\/span><\/div>\n

\u4f8b\u5982\u6211\u670917\u4e2a\u8282\u70b9\uff0c\u4f9d\u6b21\u5c06\u6bcf\u4e2a\u8282\u70b9\u7684root\u5206\u522b\u8fdb\u884c\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5faa\u73af\u4e00\u6b21\u5373\u53ef\u5168\u90e8ssh\u901a<\/p>\n

\u56db\u3001\u9a8c\u8bc1<\/strong><\/span><\/div>\n
ssh 192.168.1.20 #server ip<\/pre>\n
rsh\u514d\u5bc6\u4e92\u4fe1\u64cd\u4f5c<\/strong><\/div>\n
\u4e00\u3001\u5b89\u88c5rsh\u670d\u52a1<\/strong><\/span><\/div>\n
yum install -y rsh rsh-server\r\nyum install -y xinetd<\/pre>\n
\u4e8c\u3001\u5728\/etc\/xinetd.d\/\u4e0b\u5206\u522b\u6dfb\u52a0rsh,rlogin,rexec\u6587\u4ef6\uff08\u5982\u679c\u6ca1\u6709\uff0c\u5219\u521b\u5efa\uff09<\/strong><\/span><\/div>\n
vi \/etc\/xinetd.d\r\n\r\nvi \/etc\/rlogin\r\n\r\nvi \/etc\/rexec<\/pre>\n

rsh<\/p>\n

service shell { \r\n    disable = no \r\n    socket_type = stream \r\n    wait = no \r\n    user = root \r\n    log_on_success += USERID \r\n    log_on_failure += USERID \r\n    server = \/usr\/sbin\/in.rshd \r\n}\r\n<\/pre>\n

rlogin<\/p>\n

service login { \r\n    disable = no \r\n    socket_type = stream \r\n    wait = no \r\n    user = root \r\n    log_on_success += USERID \r\n    log_on_failure += USERID \r\n    server = \/usr\/sbin\/in.rlogind \r\n}\r\n<\/pre>\n
\u4e09\u3001\u5728\/etc\/securetty\u6587\u4ef6\u4e0b\u6dfb\u52a0rsh,rlogin,rexec\u8fd9\u4e09\u884c<\/strong><\/span><\/div>\n

\u4e4b\u540e\u5728\u547d\u4ee4\u884c\u8f93\u5165<\/p>\n

echo \"rsh\" >> \/etc\/securetty\r\necho \"rlogin\" >> \/etc\/securetty\r\necho \"rexec\" >> \/etc\/securetty<\/pre>\n
\u56db\u3001\u5728\/etc\/hosts.equiv\u4e0b\u6dfb\u52a0\u5404\u4e2a\u8282\u70b9\u540d\u79f0<\/strong><\/span><\/div>\n

\uff08\u5982\u679c\u6ca1\u6709\uff0c\u5219\u521b\u5efa\uff09<\/p>\n

cat \/etc\/hosts.equiv\r\n\r\n\r\nnode29\r\nnode30\r\nnode31\r\nnode32\r\nnode33\r\nnode34\r\nnewnode1<\/pre>\n
\u4e94\u3001root\u7528\u6237\u9700\u8981\u5728\/root\/\u4e0b\u521b\u5efa.rhosts\u6587\u4ef6<\/strong><\/span><\/div>\n

\u6587\u4ef6\u5185\u5bb9\u4e0e\/etc\/hosts.equiv\u76f8\u540c<\/p>\n

\u516d\u3001\u542f\u52a8\u670d\u52a1<\/strong><\/span><\/div>\n
systemctl restart rsh.socket\r\nsystemctl restart rlogin.socket\r\nsystemctl restart rexec.socket\r\nsystemctl enable rsh.socket\r\nsystemctl enable rlogin.socket\r\nsystemctl enable rexec.socket\r\n<\/pre>\n
\u4e03\u3001\u542f\u52a8xinetd<\/strong><\/span><\/div>\n
systemctl restart xinetd<\/pre>\n","protected":false},"excerpt":{"rendered":"

1\u3001\u4ee5root\u7528\u6237\u767b\u5f55\uff0c\u66f4\u6539ssh\u914d\u7f6e\u6587\u4ef6 \/etc\/ssh\/sshd_config\uff0c\u53bb\u9664\u4ee5\u4e0b\u914d\u7f6e\u7684\u6ce8\u91ca RS […]<\/p>\n","protected":false},"author":310,"featured_media":225960,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-225942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/225942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=225942"}],"version-history":[{"count":18,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/225942\/revisions"}],"predecessor-version":[{"id":226221,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/225942\/revisions\/226221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/225960"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=225942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=225942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=225942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}