ssh--Remote access to ubuntu

http://blog.csdn.net/hgz_gs/article/details/52039218

Install ssh

$sudo apt-get install vn4server

$sudo apt-get install openssh-server

$sudo apt-get install openssh-client

Start service

$vncserver

You need to set the password twice for the first startup

$sudo /etc/init.d/ssh restart// restart

$ sudo /etc/init.d/stop // stop

$sudo /etc/init.d/start // start

boot:

$gedit /etc/rc.local join

/etc/init.d/ssh start

Or service ssh start

Check whether the progress service is started:

$ pe -e | grep ssh

How to succeed with sshd and ssh-agent, otherwise it is not installed or not started



Out of service

$vncserver -kill1


Windows remote connection to ubuntu:

Tool: SecureCRT

File-->Quick connection

Protocol SSH2
Host name:
ip of ubuntu
Port:
22 if /etc/ ssh/sshd_config is not modified
Username:
ubuntu username

ubuntu remotely connect to ubuntu:

ssh 用户名@主机名//用户名与主机名都是要被连接端的

或者:ssh -l hyx 192.168.0.103 //hyx,被连接的用户名 ,被连接ip

不同网段实现文件共享与ssh互联:

·$sudo apt-get install udhcpc

·把虚拟机的网络适配器设置为桥接模式

·$sudo udhcpc //自动获取ip

在另一台机器上通过SecureCRT进行连接
Samba服务也能进行访问了

亲测连接wifi的win7笔记本与台式电脑的vm虚拟机ubuntu进行远程与samba共享


禁止使用管理员权限访问ssh,开通普通用户访问ssh

$sudo vi /etc/ssh/sshd_config

也可以设置允许和拒绝ssh的用户/用户组: 
DenyUsers:username,DenyGroups:groupname

优先级如下: 
DenyUsers:username 
AllowUsers:username 
DenyGroups:groupname 
AllowGroups:groupname

在文件末尾添加  AllowUsers:你的用户名


Guess you like

Origin blog.csdn.net/hgz_gs/article/details/52039218