个人工具
104.160.18.24
该IP地址的讨论
登录
查看“模板:USJ Adjust SSH”的源代码 - Ubuntu中文
模板
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“模板:USJ Adjust SSH”的源代码
来自Ubuntu中文
←
模板:USJ Adjust SSH
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Adjust SSH for remote connections == *The default SSH port is 22, but this may conflict with other SSH servers on your network. Change the SSH port to a custom port. Also disallow password-based logins, for now, to prevent unauthorized logins. See [[Ubuntu:All#Setup_an_SSH_server|this tutorial]]. sudo gedit /etc/ssh/sshd_config :change the listening port: Port ''22199'' :and disallow Password-based authentication by changing the line:: #PasswordAuthentication yes :to PasswordAuthentication no :*Make sure the OpenSSH server knows that it must look for the authorized_keys file. Uncomment the line: #AuthorizedKeysFile %h/.ssh/authorized_keys so that it resembles: AuthorizedKeysFile %h/.ssh/authorized_keys :then restart the OpenSSH server: sudo /etc/init.d/ssh restart *Make sure the router forwards the selected listening port (e.g. ''22199'') to the IP address (e.g. ''192.168.0.99'') of the server. *Install X11VNC: sudo apt-get install x11vnc :Add an ''X11VNC Server'' menu item with the command: x11vnc --forever :-> Place in system tray (''ticked'') *Create an SSH keypair for automated login: :*Generate a key pair (by default, a 2048-bit RSA key pair is created): ssh-keygen :*Accept the default location for the key file ( /home/''user''/.ssh/id_rsa ). :*Leave the passphrase empty *Make sure the directory /home/''serveruser''/.ssh exists; if not, create one using: mkdir ~/.ssh :(In this instance, ''user'' = ''serveruser'' = ''jauntyadmin00'', so the folder /home/''jauntyadmin00''/.ssh ought to already exist). Make sure that a file named authorized_keys (with write privileges) is in that folder. If not, create such a file (using the touch command to create an empty file) while logged into the server as ''serveruser'' (i.e. ''jauntyadmin00''): cd ~/.ssh touch authorized_keys :Concatenate the newly-generated id_rsa.pub key to the authorized_keys file: cd ~/.ssh cat authorized_keys id_rsa.pub >> authorized_keys *Create a test connection: :*Start the X11VNC Server (as above) :*Connect VNC through the SSH tunnel with the commands: ssh -l ''jauntyadmin00'' -L 5900:127.0.0.1:5900 ''myjaunty00.dyndns.org'' -p ''22199'' vinagre vnc://127.0.0.1 or with a single-line command (which can be placed in a Menu item / shortcut): ssh -f -l ''jauntyadmin00'' -L 5900:127.0.0.1:5900 ''myjaunty00.dyndns.org'' -p ''22199'' sleep 5; vinagre vnc://127.0.0.1 Note: ''vinagre -- fullscreen vnc://127.0.0.1'' will start the VNC connection in fullscreen mode (but should only be used when connecting from other computers).
返回至
模板:USJ Adjust SSH
。