Update: this can cause some of your ssh sessions to hang, so be aware of that.
Add this to your ~/.ssh/config
Host myserver.mydomain.com
ControlMaster auto
ControlPath /tmp/%r@%h:%p
Then, say you have root access via your ssh pub key
mkdir tmp001
sshfs -o uid=1000 root@myserver.mydomain.com:/var/www tmp001
Now, the files in tmp001 map to your remote /var/www directory. And access to them uses an ssh session that is maintained in your /tmp directory, i.e. all interactions are performed over the same ssh session.
To see the tmp file, if you just opened the sshfs session in the last 10 mins
find /tmp -mmin -10 -ls
Showing posts with label remote. Show all posts
Showing posts with label remote. Show all posts
Wednesday, 6 August 2014
Thursday, 5 June 2014
OpenVPN: push all LAN traffic through an OpenVPN client to the other side
- Local variables for this post, adjust to fit your setup:
- OpenVPN client server IP
- 192.168.1.200
- Remote network
- 172.16.1.0/24
- Add this to the client server that is using OpenVPN to connect to the remote server:
- sudo iptables -A POSTROUTING -o tun0 -j MASQUERADE
- as root user, do
- echo 1 > /proc/sys/net/ipv4/ip_forward
- Add this to your local computer
- Linux:
- ip route add 172.16.1.0/24 via 192.168.1.200
- Mac:
- route -n add 172.16.1.0/24 192.168.1.200
NOTE: take a look at /etc/sysctl.conf if you want the ip_forward to last through reboots of client server: net.ipv4.ip_forward=1
Thursday, 25 April 2013
Edit remote files with local editor using ssh and sshfs
- apt-get -y install sshfs
- Add your local user to the fuse group
- mkdir ~/mylocaldir
- sshfs -o idmap=user mylocaluser@myremoteserver.com:/remotepath ~/mylocaldir
- Edit files under ~/mylocaldir, and as you save them, they are automatically updated in /remotepath
Errors
- "Couldn't read packet: Connection reset by peer"
- change this line in your /etc/ssh/sshd_config file to match what's here
- Subsystem sftp internal-sftp
- happens on RedHat Enterprise 6.1 for sure
Thursday, 28 March 2013
Run one command on many Linux servers, install pssh, works on Mac
- sudo easy_install pip
- sudo pip install pssh
- Create a file with the list of servers you want to control, call it servers or something similar
- pssh -h servers "date"
- Put your ssh pub key up to all of them
- pssh -h servers -i "echo 'ssh-rsa AA...wh me@myfqdn' >> /home/user/.ssh/authorized_keys"
Taken: http://kaspergrubbe.dk/2012/using-pssh-for-executing-parallel-ssh-commands/
Note: csshX is very nice if you want to see all terminals at once as you type, more later
Note: csshX is very nice if you want to see all terminals at once as you type, more later
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
CRITICAL: AWS now offers internal VPC DNS! Below is no longer necessary AFAIK. Woo hoo! http://aws.amazon.com/about-aws/whats-new/2014/...
-
build sudo apt-get install git gcc sudo apt-get install automake autoconf git clone git://github.com/rriley/tsunami-udp.git cd tsunam...
-
From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4 Assumptions: jEdit was installed into /Applications directory. Close any...