使用C#通过root帐户登录SSH [英] SSH login with root account using C#

查看:270
本文介绍了使用C#通过root帐户登录SSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Renci.SshNet;

private static void SSH_Connection()

{

string user =user;

string pass =password;

string host =172.1.1.1;



SshClient _sshClient = new SshClient(主持人,22,用户,通行证);

_sshClient.Connect();

}



我是能够通过ssh使用用户帐户访问Unix,但使用root帐户访问是否正确(root帐户被锁定以进行远程访问但是控制台端口)?



我尝试了什么:



在PUTTY上,使用用户帐户登录并输入'admin'将成为root帐户。

是否可以在c#编程中执行此操作?

using Renci.SshNet;
private static void SSH_Connection()
{
string user = "user";
string pass = "password";
string host = "172.1.1.1";

SshClient _sshClient = new SshClient(host, 22, user, pass);
_sshClient.Connect();
}

I am able to access Unix through ssh using user account, but is it positive to access with root account(root account is locked for remote access but console port)?

What I have tried:

On PUTTY, login with user account and input 'admin' will become as root account.
Is it able to do it on c# programming?

推荐答案

如果您没有root密码,或者root被禁用以进行远程访问,那么您只能使用用户帐户。
If you do not have the root password, or root is disabled for remote access, then you can only use the user account.


这篇关于使用C#通过root帐户登录SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆