Linux

Run X programs through ssh

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 […]

Read More
Linux

Deny SSH- but allow SFTP access

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 thisMatch User usernameAllowTcpForwarding noX11Forwarding noForceCommand /usr/libexec/sftp-server -l INFO Replace username with the user name you would limit the SSH access […]

Read More
Linux

Execute commands on multiple hosts using ssh

#!/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 “——————————–” […]

Read More
Linux

Synchronize current directory with remote one using rsync

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 -r synchronize directories […]

Read More