A easy way to run remote X programs (from another host) on your local linux installation is to connect to it via ssh using the -Y switch.
For instance if you would like to run up2date in graphical mode on a remote machine but the server doesn’t have X installed. Then this is a great way of doing it.
On your host
ssh -Y remote_machine_name.com
When you have successfully connected to the remote host you start the up2date command.
up2date
Soon after you will get the up2date windows on your local linux machine.
Your sshd server should have enabled the X11Forwarding directive. This is enabled in your local local machines ssh config /etc/ssh/sshd_config file
X11Forwarding yes
The command you run can be anything else, for instance xterm.
Posted by Hans-Henry Jakobsen
This is an alternative way of limiting the SSH access to only SFTP explained in my How to restrict users to SFTP only instead of SSH post.
Edit your /etc/sshd_config file and change your settings like this
Match User username
AllowTcpForwarding no
X11Forwarding no
ForceCommand /usr/libexec/sftp-server -l INFO
Replace username with the user name you would limit the SSH access for.
Posted by Hans-Henry Jakobsen
#!/bin/bash # Linux/UNIX box with ssh key based login SERVERS=”192.168.1.1 192.168.1.2 192.168.1.3″ # SSH User name USR=”jadmin” # Email SUBJECT=”Server user login report” EMAIL=”admin@somewhere.com” EMAILMESSAGE=”/tmp/emailmessage.txt” # create new file >$EMAILMESSAGE # connect each host and pull up user listing for host in $SERVERS do echo “——————————–” >>$EMAILMESSAGE echo “* HOST: $host ” >>$EMAILMESSAGE echo “——————————–” >>$EMAILMESSAGE ssh $USR@$host w >> $EMAILMESSAGE done # send an email using /bin/mail /bin/mail -s “$SUBJECT” “$EMAIL” < $EMAILMESSAGE
Posted by Hans-Henry Jakobsen
This is a simple way to synchronize all the files from the current computer to a remote computer using SSH as transportation protocol.
rsync -raz --progress --delete --bwlimit=4096 /synchronize/from/this-folder/ remote-server:/to/this-folder/
This example is using PUT as transfer method because the files are put from the local computer to the remote.
Options explained
Posted by Hans-Henry Jakobsen
dd bs=1M if=/dev/hda | gzip | ssh user@remote 'dd of=hda.gz'
Posted by Hans-Henry Jakobsen