ubuntu ssh putty ubuntu启动ssh

ubuntu修改了ssh配置后 putty 还是出现access denied

你可以从以下几点查看实验下。

首先,先备份一下配置文件。

mkdir~/backup

cp/etc/ssh/ssh_config~/backup/ssh_config

第二步,编辑文件:

vi/etc/ssh/ssh_config

使用“/”搜搜看下Allow/Deny开头的项目,全部注释掉。(我查看了下,有些文章说AllowUsers参数会限制访问用户,需要在后面添加root,才能使用root账户ssh登陆,但我在我的centos7的ssh_config文件中未看到此参数,虽然有一些其他Allow\Deny开头的参数,不过全部都是被注释状态。可以参考最后我的sshd_config文件。)

修改完成后,重启服务/etc/init.d/ssh start(参考的百度出来的文章结果,我实际实验结果是:守护进程里并没有ssh,无法运行此命令,chkconfig里也没有sshd进程,service也无法重启ssh,所以我直接reboot了系统)

如果,依然不行进行下一步。

第三步,同网段内其他windows主机打开cmd,查看主机ssh端口(如果修改了默认端口,得自行把22修改为正确端口)是否正常。

win+r,输入cmd

ping(ubuntu主机IP地址)#首先要保证网络通

telnet(ubuntu主机IP地址)22#查看端口是否通

如果正常,应该显示类似“SSH-2.0-OpenSSH_6.6.1”的消息,或者是纯黑屏,再次点击回车断开连接。

第四步,如果上一步显示不正常,可能是防火墙设置问题,关闭或设置防火墙

ufw disable(方法一:关闭防火墙)

ufw allow 22/tcp(方法二:打开端口22)

(注:我用的centos采用的是最小化安装,未安装防火墙,这一步骤是我参考的网上资料,未进行实验。具体可自行百度。)

最后附上我的ssh_config文件。

#$OpenBSD:sshd_config,v1.932014/01/1005:59:19djmExp$

#Thisisthesshdserversystem-wideconfigurationfile.See

#sshd_config(5)formoreinformation.

#ThissshdwascompiledwithPATH=/usr/local/bin:/usr/bin

#Thestrategyusedforoptionsinthedefaultsshd_configshippedwith

#OpenSSHistospecifyoptionswiththeirdefaultvaluewhere

#possible,butleavethemcommented.Uncommentedoptionsoverridethe

#defaultvalue.

#IfyouwanttochangetheportonaSELinuxsystem,youhavetotell

#SELinuxaboutthischange.

#semanageport-a-tssh_port_t-ptcp#PORTNUMBER

#

#Port22

#AddressFamilyany

#ListenAddress0.0.0.0

#ListenAddress::

#Thedefaultrequiresexplicitactivationofprotocol1

#Protocol2

#HostKeyforprotocolversion1

#HostKey/etc/ssh/ssh_host_key

#HostKeysforprotocolversion2

HostKey/etc/ssh/ssh_host_rsa_key

#HostKey/etc/ssh/ssh_host_dsa_key

HostKey/etc/ssh/ssh_host_ecdsa_key

HostKey/etc/ssh/ssh_host_ed25519_key

#Lifetimeandsizeofephemeralversion1serverkey

#KeyRegenerationInterval1h

#ServerKeyBits1024

#Ciphersandkeying

#RekeyLimitdefaultnone

#Logging

#obsoletesQuietModeandFascistLogging

#SyslogFacilityAUTH

SyslogFacilityAUTHPRIV

#LogLevelINFO

#Authentication:

#LoginGraceTime2m

#PermitRootLoginyes

#StrictModesyes

#MaxAuthTries6

#MaxSessions10

#RSAAuthenticationyes

#PubkeyAuthenticationyes

#Thedefaultistocheckboth.ssh/authorized_keysand.ssh/authorized_keys2

#butthisisoverriddensoinstallationswillonlycheck.ssh/authorized_keys

AuthorizedKeysFile.ssh/authorized_keys

#AuthorizedPrincipalsFilenone

#AuthorizedKeysCommandnone

#AuthorizedKeysCommandUsernobody

#Forthistoworkyouwillalsoneedhostkeysin/etc/ssh/ssh_known_hosts

#RhostsRSAAuthenticationno

#similarforprotocolversion2

#HostbasedAuthenticationno

#Changetoyesifyoudon'ttrust~/.ssh/known_hostsfor

#RhostsRSAAuthenticationandHostbasedAuthentication

#IgnoreUserKnownHostsno

#Don'treadtheuser's~/.rhostsand~/.shostsfiles

#IgnoreRhostsyes

#Todisabletunneledcleartextpasswords,changetonohere!

#PasswordAuthenticationyes

#PermitEmptyPasswordsno

PasswordAuthenticationyes

#Changetonotodisables/keypasswords

#ChallengeResponseAuthenticationyes

ChallengeResponseAuthenticationno

#Kerberosoptions

#KerberosAuthenticationno

#KerberosOrLocalPasswdyes

#KerberosTicketCleanupyes

#KerberosGetAFSTokenno

#KerberosUseKuserokyes

#GSSAPIoptions

GSSAPIAuthenticationyes

GSSAPICleanupCredentialsno

#GSSAPIStrictAcceptorCheckyes

#GSSAPIKeyExchangeno

#GSSAPIEnablek5usersno

#Setthisto'yes'toenablePAMauthentication,accountprocessing,

#andsessionprocessing.Ifthisisenabled,PAMauthenticationwill

#beallowedthroughtheChallengeResponseAuthenticationand

#PasswordAuthentication.DependingonyourPAMconfiguration,

#PAMauthenticationviaChallengeResponseAuthenticationmaybypass

#thesettingof"PermitRootLoginwithout-password".

#IfyoujustwantthePAMaccountandsessioncheckstorunwithout

#PAMauthentication,thenenablethisbutsetPasswordAuthentication

#andChallengeResponseAuthenticationto'no'.

#WARNING:'UsePAMno'isnotsupportedinRedHatEnterpriseLinuxandmaycauseseveral

#problems.

UsePAMyes

#AllowAgentForwardingyes

#AllowTcpForwardingyes

#GatewayPortsno

X11Forwardingyes

#X11DisplayOffset10

#X11UseLocalhostyes

#PermitTTYyes

#PrintMotdyes

#PrintLastLogyes

#TCPKeepAliveyes

#UseLoginno

UsePrivilegeSeparationsandbox#Defaultfornewinstallations.

#PermitUserEnvironmentno

#Compressiondelayed

#ClientAliveInterval0

#ClientAliveCountMax3

#ShowPatchLevelno

#UseDNSyes

#PidFile/var/run/sshd.pid

#MaxStartups10:30:100

#PermitTunnelno

#ChrootDirectorynone

#VersionAddendumnone

#nodefaultbannerpath

#Bannernone

#Acceptlocale-relatedenvironmentvariables

AcceptEnvLANGLC_CTYPELC_NUMERICLC_TIMELC_COLLATELC_MONETARYLC_MESSAGES

AcceptEnvLC_PAPERLC_NAMELC_ADDRESSLC_TELEPHONELC_MEASUREMENT

AcceptEnvLC_IDENTIFICATIONLC_ALLLANGUAGE

AcceptEnvXMODIFIERS

#overridedefaultofnosubsystems

Subsystemsftp/usr/libexec/openssh/sftp-server

#Exampleofoverridingsettingsonaper-userbasis

#MatchUseranoncvs

#X11Forwardingno

#AllowTcpForwardingno

#PermitTTYno

#ForceCommandcvsserver

ubuntu怎么通过putty远程登录

ubuntu16.04远程远程登录linux系统的方法

在路由器上我们经常遇到一个问题,那就是想开发路由器就必须先获取SSH权限,那么SSH是什么呢?

SSH为 Secure Shell的缩写,SSH是建立在应用层和传输层基础上的安全协议。SSH可以有效防止远程管理过程中的信息泄露,专为远程登录会话和其他网络服务提供安全性的协议。

所以利用SSH远程协议我们也可以对虚拟机中的Ubuntu进行远程操控了,那么如何来实现这一功能呢?

首先我们先确认下ubuntu系统是否已经安装ssh(通常ubuntu中默认是安装的),通过命令进行查看:

dpkg-l| grep ssh

这里我们可以看到,系统显示已经安装了openssh-client,但是没有openssh-server。

说明ssh没有完成安装,这里我们可以重新安装openssh-client和openssh-server。在终端使用下列命令进行安装:

sudo apt-get install openssh-client

sudo apt-get install openssh-server

如果出现以上所以,说明安装被打断,要使用提示的sudo dpkg--configure-a进行安装:

我们就手动执行以下命令:

sudo dpkg--configure-a

再返回安装openssh-client和openssh-server,在终端使用下列命令进行安装:

sudo apt-get install ssh

现在我们可以看到系统已经安装了openssh-client和openssh-server。

接下来我们来启动ssh服务,执行以下命令:

sudo/etc/init.d/ssh start

系统显示:[ ok ] Starting ssh(via systemctl): ssh.service.说明已经启动了SSH服务。

如果你想停止ssh服务,则执行以下命令即可:

sudo/etc/init.d/ssh stop:

接着我们通过ifconfig命令,查看系统的ip地址,ssh的端口号一般为

图中所框选的ip就是我们系统的IP地址

接下来我们就可以在我们的windows系统中打开ssh客户端软件,这里小编喜欢使用Putty,输入ubuntu系统的ip地址(192.168.204.128)和端口(22)

然后在弹出的窗口中根据提示输入账户和密码,就可以通过ssh登录到ubuntu系统中,并远程执行各种命令操作。

密码输入不显示,直接enter继续即可。

配置Ubuntu 18.04的串口终端并用PuTTY连接

配置Ubuntu 18.04的串口终端并用PuTTY连接,实现在一台Windows电脑上控制没有显示屏或SSH连接的Ubuntu电脑。

步骤一:购买串口线

如果Ubuntu电脑自带串口,确认其外观形状。如没有串口,需购买USB-串口转换线,确保选择常见型号的内部转换芯片,以便于驱动安装。

步骤二:配置USB串口转换线驱动

访问FTDI官网下载适用于Windows操作系统的免费驱动。下载Windows的二进制安装包,并安装。

步骤三:插入转换线与识别设备

插入USB-串口转换线后,通过设备管理器检查新添加的USB设备和串口设备(如COM11)。

步骤四:配置PuTTY

下载并安装PuTTY,打开后选择Serial连接,输入COM端口号(如COM11),设置波特率为115200。保存设置并打开连接。

步骤五:配置Ubuntu 18.04的串口终端

在Ubuntu端,确认串口编号,安装setserial,运行命令检查当前串口状态。编辑grub配置文件,添加或修改相关参数以启用串口终端。重启Ubuntu,打开PuTTY窗口,即可实现与Ubuntu的连接。

最终步骤:实现控制

几分钟后,Ubuntu电脑重启,通过PuTTY窗口显示grub启动页面。启动Ubuntu后,登录并进入熟悉的Bash终端,完成控制Ubuntu电脑的配置过程。

阅读剩余
THE END