我在两台笔记本电脑上都运行64位Ubuntu 14.04.1 LTS,目前它们都连接到同一家庭Wi-Fi。
我想通过其中一台计算机连接到另一台计算机,例如,通过SSH
,我该怎么做?我应该对两台计算机都知道哪些凭证以及应该使用哪个命令?
我的意图不是简单的文件共享,我想要除Teamviewer等之外的其他解决方案,尽管X-Windows转发会很好。感谢您在此问题上的协助。
编辑:当我尝试SSH时,在提示符下显示以下内容:
VesnogXPS:~$ ssh [email protected]
ssh: connect to host 192.168.1.22 port 22: Connection refused
Edit2:上面的问题已解决,但现在它无法读取所连接计算机上的.bashrc文件的权限如下:
-rw-r--r-- 1 ongun ongun 3567 Jan 4 01:06 .bashrc
我得到的错误如下,它仅在从A连接到B时出现,而不是在从B连接到A时出现:
[email protected]'s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-45-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Thu Feb 19 18:52:54 2015 from 192.168.1.22
-bash: /home/ongun/.bashrc: Permission denied
有问题的笔记本电脑上〜/ .profile的内容是:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
"$HOME/.bashrc"
PATH=/usr/local/texlive/2013/bin/i386-linux:$PATH; export PATH
MANPATH=/usr/local/texlive/2013/texmf-dist/doc/man:$MANPATH; export MANPATH INFOPATH=/usr/local/texlive/2013/texmf-dist/doc/info:$INFOPATH; export INFOPATH
fi
fi
找出问题所在是不是采购,.bashrc
我确实在第二步之后更改了行,如下所示:。“ $ HOME / .bashrc”
现在一切正常,但是我还有一个问题,为什么它用于本地计算机上的终端仿真器而不是SSH本身?我问这是因为两者都是交互式登录Shell。
首先,您需要知道笔记本电脑的IP地址(尝试ifconfig
或ip addr show
其他方法),假设笔记本电脑A的IP为“ 192.168.1.4”,笔记本电脑B的IP为“ 192.168.1.5”。要从ssh
A到B反之亦然,您需要通过以下命令在两台笔记本电脑上安装ssh服务器:
sudo apt-get install openssh-server
由于默认情况下会自动安装客户端,因此您现在可以ssh
通过以下两种方式之一进行操作:
ssh [email protected] ##From B to A
ssh [email protected] ##From A to B
这里的“用户名”是您登录的“ 192.168.1.4/192.168.1.5”的任何用户。
如果要ssh
X11转发,请尝试以下操作:
ssh -Y [email protected]
ssh -Y [email protected]
阅读ssh的联机帮助页以获得更多想法。
编辑:如注释中建议的“ Rmano”,您可以检查“ DHCP预分配”。看看这个和这个。
编辑的答案:我认为您尚未openssh-server
在192.168.1.22上安装,导致错误连接被拒绝。您可以通过执行以下操作来检查192.168.1.11的哪些tcp端口处于侦听状态:
netstat -tlpn
从192.168.1.22开始,然后通过查找端口22 netstat -tlpn | grep 22
。您也可以从192.168.1.11进行检查:
nmap -PN 192.168.1.22
对第二个编辑的回答:问题是您正在执行~/.profile
而不是~/.bashrc
通过. $HOME/.bashrc
它来采购文件"$HOME/.bashrc"
。该代码段应为:
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句