Questions Tagged With sshhttp://linuxexchange.org/tags/ssh/?type=rssquestions tagged <span class="tag">ssh</span>enThu, 23 Apr 2015 17:12:38 -0400how to define variable in sshhttp://linuxexchange.org/questions/3525/how-to-define-variable-in-ssh<p>I need to use <code>ssh</code> to send command to different computers to run programs. Can I define a variable of <code>Directory</code> and <code>program</code> in front of this shell script? Then, I do not need to write them every time?</p> <p><code>host_list=("c15-0330-10.ad.mtu.edu" "c15-0330-11.ad.mtu.edu" "c15-0330-12.ad.mtu.edu")</code> <code># I have multiple programs</code> <code># program=c("L_1","L_2","L_3")</code> <code>ssh -f "${host_list[0]}" 'set Directory="/home/campus27/zwang10/Desktop/AWRR/program/power/vmodel_1/nprot/K_10"; cd $Directory &amp;&amp; nohup Rscript L_1.R&gt; L_1_sh.txt;echo "The job L_1 is finished" |mutt "zwang10@mtu.edu" -s "The job L_1 is finished"'; ssh -f "${host_list[1]}" 'set Directory="/home/campus27/zwang10/Desktop/AWRR/program/power/vmodel_1/nprot/K_10"; cd $Directory &amp;&amp; nohup Rscript L_2.R&gt; L_2_sh.txt;echo "The job L_2 is finished" |mutt "zwang10@mtu.edu" -s "The job L_2 is finished"'; ssh -f "${host_list[2]}" 'set Directory="/home/campus27/zwang10/Desktop/AWRR/program/power/vmodel_1/nprot/K_10"; cd $Directory &amp;&amp; nohup Rscript L_3.R&gt; L_3_sh.txt;echo "The job L_3 is finished" |mutt "zwang10@mtu.edu" -s "The job L_3 is finished"';</code></p>zwang10Thu, 23 Apr 2015 17:12:38 -0400http://linuxexchange.org/questions/3525/how-to-define-variable-in-sshterminalshell-scriptsshCan i switch to a timed out ssh session?http://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-session<p>I got timed out of a ssh session. Is there a way I can switch back to it if it still exists?</p>electronbenderTue, 12 Apr 2011 14:54:27 -0400http://linuxexchange.org/questions/2325/can-i-switch-to-a-timed-out-ssh-sessionsshbashNFS over SSH. RPC Errorhttp://linuxexchange.org/questions/1287/nfs-over-ssh-rpc-error<p>Hi,</p> <p>I have seen many articles saying that to get rid of this error I should be using portmap, that's fine but how do I use it over ssh...</p> <p>I am trying to mount NFS over SSH. I have the server configured to export the share and I can mount it correctly over the network, however company policy is to ONLY allow ssh access.</p> <p>On the server side; ]# cat /etc/exports</p> <p>/home/Shared localhost(rw,no_root_squash,async)</p> <p>]# rpcinfo -p</p> <p>program vers proto port</p> <pre><code>100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 49449 status 100024 1 tcp 36697 status 100021 1 udp 34934 nlockmgr 100021 3 udp 34934 nlockmgr 100021 4 udp 34934 nlockmgr 100021 1 tcp 37221 nlockmgr 100021 3 tcp 37221 nlockmgr 100021 4 tcp 37221 nlockmgr 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100005 1 udp 2051 mountd 100005 1 tcp 2051 mountd 100005 2 udp 2051 mountd 100005 2 tcp 2051 mountd 100005 3 udp 2051 mountd 100005 3 tcp 2051 mountd </code></pre> <p>The on the client side I use 2 ssh tunnels;</p> <p>]# ssh -f -N -L 52051:localhost:2051 my.server</p> <p>]# ssh -f -N -L 52049:localhost:2049 my.server</p> <p>I can telnet to these ports and receive a response. So now I try to mount;</p> <p>]# mount -t nfs -o nolock,port=52049,mountport=52051 localhost:/home/Shared /mnt/Shared</p> <p>mount.nfs: mount to NFS server 'localhost:/home/Shared' failed: RPC Error: Program not registered</p> <p>So it <em>seems</em> as if the problem is caused by mount talking to the local portmap, however I thought the mount options were supposed to stop that. Obviously I cannot forward portmapper from the server to the client's port 111 as that would disrupt the client's portmapper.</p> <p>I am using SUSE 11.2 for the client and Ubuntu 10.04 as the server.</p>Dave 1Tue, 24 Aug 2010 17:50:10 -0400http://linuxexchange.org/questions/1287/nfs-over-ssh-rpc-errorrpcnfssshlinuxchroot FTP vs SFTPhttp://linuxexchange.org/questions/433/chroot-ftp-vs-sftp<p>Is there any advantage in using an FTPd in a chroot environment over using SFTP that is standard with SSHd?</p>ranxxeroxMon, 10 May 2010 16:21:18 -0400http://linuxexchange.org/questions/433/chroot-ftp-vs-sftpftpsshchrootConnect via SSH/Samba from 1 box to a hidden box (NAT/PAT?) setup?http://linuxexchange.org/questions/145/connect-via-sshsamba-from-1-box-to-a-hidden-box-natpat-setup<p>I need to access a Linux box via SSH &amp; Samba that is hidden/connected behind another one.</p> <p>Setup :-</p> <pre> A switch B C |----| |---| |----| |----| |eth0|----| |----|eth0| | | |----| |---| |eth1|----|eth1| |----| |----| </pre> <p>Eg, SSH/Samba from A to C</p> <p>How does one go about this?<br> I was thinking that it cannot be done via IP alone? Or can it?</p> <p>Could B say "hi on eth0, if your looking for 192.168.0.2, its here on eth1"?<br> Is this NAT? This is a large private network, so what about if another PC has that IP?!</p> <p>More likely it would be PAT?<br> A would say "hi 192.168.109.15:1234"<br> B would say "hi on eth0, traffic for port 1234 goes on here eth1"<br> How could that be done? </p> <p>And would the SSH/Samba demons see the correct packet header info and work??</p> <p>IP info :-</p> <pre> A - eth0 - 192.168.109.2 B - eth0 - 192.168.109.15 - eth1 - 192.168.0.1 C - eth1 - 192.168.0.2 </pre> <p>A, B &amp; C are RHEL (RedHat) But Windows computers can be connected to the switch. I configured the 192.168.0.* IPs, they are changeable.</p> <p>Any help?</p>Ian VaughanWed, 28 Apr 2010 17:02:58 -0400http://linuxexchange.org/questions/145/connect-via-sshsamba-from-1-box-to-a-hidden-box-natpat-setupsshsambanatpatnetworking