- 在两台机器上有相同的账号情况下, 本地机器A, 远程机器B
A上Terminal运行:
1. ssh-keygen
2. ssh-copy-id B的IP
- 当远程机器B上无当前账号,但是有root权限时
- B上Terminal运行:
- useradd Zack
- usermod -G root Zack --- 加入root组/也可不加
- id Zack -- 查看新增用户信息
- passwd Zack -- 修改密码
-
A上Terminal运行:
- ssh-keygen
- ssh-copy-id B的IP
- 如果要删除B上的用户,运行 userdel Zack
- B上Terminal运行:
之后即可 从A上 ssh B的IP 了, 或者 scp xxxx