如何开启ssh服务 SERVER服务

博客访问: 234117
博文数量: 30
博客积分: 1530
博客等级: 上尉
技术积分: 457
注册时间:
专注到了极致,也就简单到了极致!
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: LINUX
Ubuntu缺省安装了openssh-client,所以在这里就不安装了,如果你的系统没有安装的话,再用apt-get安装上即可。
安装ssh-server
sudo apt-get install openssh-server
安装ssh-client
sudo apt-get install openssh-client
2.确认sshserver是否安装好
ps -e | grep sshd
& 450 ?&&&&&&& 00:00:00 sshd
如果看到sshd那说明ssh-server已经启动了。
如果只有ssh-agent说明ssh-server还没有启动,需要执行命令启动ssh服务:
/etc/init.d/ssh start;
注:在ubuntu-12.04-server-i386.iso安装中只显示sshd这一项:
3.扩展配置
SSH默认服务端口为22,用户可以自已定义成其他端口,如222,需要修改的配置文件为:
/etc/ssh/sshd_config
把里面的Port参数修改成222即可
然后重启SSH服务:
sudo/etc/init.d/ssh restart
阅读(89170) | 评论(1) | 转发(6) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。> 博客详情
【删除原服务】
如果前面已经建立过服务,但是需要重新启用服务的需要删除服务:
services.msc中可以看cygwin sshd的属性发现服务名为sshd
cmd进入命令行,然后 sc delete sshd,屏幕上出现[SC] DeleteService SUCCESS,
本质上相当于删除HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet下的注册表项
进入services.msc发现服务已删除&
【建立新服务】
然后进入cygwin建立ssh服务:
1) 修改环境变量 PATH变量中加入Cygwin路径 添加CYGWIN变量设为ntsec tty
2) 授权:
使用windows 用户的密码和用户组&
$mkpasswd -l & /etc/passwd&
$mkgroup -l & /etc/group&&&&&&
Note:&& 设置文件权限(如果win7需要先以管理员权限运行cygwin才能使用chmod), 在域用户的时候理论上要加-d,但是经过测试没用,还是用上面的命令,配置好service之后直接连接127.0.0.1然后输入用户名即可,不需要其他密码之类的信息就可以本地ssh登录了
$chmod +r /etc/group $chmod +r /etc/passwd $chmod +rwx /var
$ ssh-host-config&
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) yes& #输入yes
*** Info: Updating /etc/sshd_config file
*** Warning: The following functions require administrator privileges!
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes& #输入yes
*** Info: Note that the CYGWIN variable must contain at least "ntsec"
*** Info: for sshd to be able to change user context without password.
*** Query: Enter the value of CYGWIN for the daemon: [ntsec] ntsec& #输入ntsec
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires.& You need to have or to create a privileged
*** Info: account.& This script will help you do so.
*** Info: You appear to be running Windows 2003 Server or later.& On 2003 and
*** Info: later systems, it's not possible to use the LocalSystem account
*** Info: for services that can change the user id without an explicit password
*** Info: (such as passwordless logins [e.g. public key authentication] via sshd).&
*** Info: If you want to enable that functionality, it's required to create a new
*** Info: account with special privileges (unless a similar account already exists).
*** Info: This account is then used to run these special servers.
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges itself.
*** Info: No privileged account could be found.
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) no& #输入no,不指定启动用户
*** Query: Create new privileged user account 'cyg_server'? (yes/no) no& #输入no,不指定启动用户
*** ERROR: There was a serious problem creating a privileged user.
*** Query: Do you want to proceed anyway? (yes/no) yes& #输入yes
*** Warning: Expected privileged user 'cyg_server' does not exist.
*** Warning: Defaulting to 'SYSTEM'
*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'.& Otherwise, it
*** Info: will start automatically after the next reboot.
*** Info: Host configuration finished. Have fun!
4) Windows下或者在cygwin窗口中直接 net start sshd& (sshd即为新建的服务,services.msc 中的Cygwin SSHD)
plus) 如果启用服务有问题可以尝试操作:
$ mkpasswd -l & /etc/passwd $ mkgroup -l & /etc/group $ cygrunsrv -R sshd $ ssh-host-config -y $ cygrunsrv -S sshd
另外putty连接ssh服务可以参考:
人打赏支持
码字总数 313790
已经update
支付宝支付
微信扫码支付
打赏金额: ¥
已支付成功
打赏金额: ¥

我要回帖

更多关于 linux如何开启ssh服务 的文章

 

随机推荐