新加坡1号

Good Luck To You!

甲骨文的主机使用ssh账号密码登陆的方法

方法很简单:

我们知道甲骨文的VPS用SSH登录的时候,都是密钥登录。如果不喜欢把密钥带身上,喜欢用密码登录的话,可以使用这个方法。

先用密钥登录SSH工具,我这里用的是xshell。

首先输入 sudo -i

切换为管理员

接着输入以下代码 :

echo root:YourPasswordHere |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart

将以上代码中的  root:YourPasswordHere  , root后面改成你想要的密码即可。

如图:

 

我在我的甲骨文的centos系统中测试成功。 用密码的方式登录上了SSH。

---------------------------------------------------------------------------------------------

Oracle云服务器(虚机实例)创建创建完成后,打开FinalShell(可以使用其他Shell登录工具)配置好相应的信息。

在此注意以下两点:


用户名是:Centos系统默认账户是opc;Ubuntu系统默认账户是ubuntu

配置使用私钥,而不是使用密码(公钥在创建服务器实例时有提示下载)


登录完成后:

#切换至root模式,并更改root的密码

$ sudo -i

passwd

#启用SSH

vim /etc/ssh/sshd_config

#更改如下

PermitRootLogin yes

PasswordAuthentication yes

#或使用如下命令

sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;

sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;

#重启sshd服务

sudo service sshd restart


现在就可以使用root来ssh登录了。


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2025年3月    »
12
3456789
10111213141516
17181920212223
24252627282930
31
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
    文章归档
    网站收藏
    友情链接

    Powered By Z-BlogPHP 1.7.3

    新加坡1号