Public
snipts » ssh
showing 1-20 of 59 snipts for ssh
-
∞ SSH via TOR using SOCAT
# start TOR tor # create tunnel socat TCP-LISTEN:<port> SOCKS4A:localhost:<host>:22,socksport=9050 # login through local tunnel ssh <user>@localhost -p <port>
-
∞ create ssh RSA id
# Create an SSH id and public key pair (RSA) on your laptop/local machine mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -q -f ~/.ssh/id_rsa -t rsa ## Enter passphrase (empty for no passphrase): … ## Enter same passphrase again: … # protect your SSH keys chmod go-w ~/ chmod 700 ~/.ssh chmod go-rwx ~/.ssh/* # Send your public id to the server. # @see http://snipt.net/jrguitar21/passwordless-rsa-ssh-1-liner/
-
∞ gits from server backup per ssh
# run 'git-archive.sh' on server scp -r -P 1234 user@192.168.0.1:~/git/*/*.tar.gz /g/git -
∞ Play music on a remote linux (debian branch) computer via SSH
#I used this technique to play music on a computer with a much better sound system from my laptop. #On the "music server" sudo apt-get install openssh-server mplayer #Once done, on the "controler" computer ssh <username>@<server_name_or_ip> cd /path/to/music/files #If you want to play only one song mplayer song.ext #If you want to play the whole directory mplayer *.ext #In case of multiple extentions (example with mp3, wma and ogg files mplayer *.mp3 *.wma *.ogg #You can control your music server from a windows comuputer with PuTTY
-
∞ ssh disable timeout firewall
http://madphilosopher.ca/2005/07/an-ssh-keep-alive-tip/ It’s worth noting that many SSH timeouts come from firewalls and no amount of tinkering with timeout settings (other than on the firewall) will fix it. The only way in these cases is to simulate traffic (which is what the client’s keepalive settings should do, but don’t always in my experience). I find this works very well (although possibly it’s overkill being in perl): perl -e 'sleep 59 && print STDERR "\x00" while 1' & Run it as soon as you SSH in, and remember the pid so you can kill it before you leave. It squirts a null every 59 seconds. If you change the \x00 for a printable character you will see it appear on your terminal but it still won’t impact what you are doing. – # Adam Reed Says: May 6th, 2007 at 0303 UTC Bruce: You can automate this by putting the following in your .kshrc (or its equivalent for your shell in its rc file, or put it in .profile (or .login)): case $- in i*s*) perl -e 'sleep 59 && print STDERR "\x00" while 1' & trap "kill ${!}" 0 ;; esac # ======================================================================================= Remember that ServerAliveInterval is limited by ServerAliveCountMax and that ServerAliveCountMax is set to 3 by default! That is, if you set ServerAliveInterval to 60 and ServerAliveCountMax is left to default value (3), after the client has sent 3 keep alive packets it will disconnect. That makes 60 x 3 = 180 seconds. So if you want more time away, you set ServerAliveInterval to 60 and ServerAliveCountMax to the numer you want (for example: 100). The client will send one keep alive packet every 0 seconds for 100 times or, if you prefer, 100 keep alive packets, one every 60 seconds. :D You set this up in your $HOME/.ssh/config file. Most of these options are explained in man ssh_config. DiskStation> grep ClientAliveInterval /etc/ssh/sshd_config ClientAliveInterval 100 -
∞ Continua descarga via SSH
alias scpresume="rsync --partial --progress --rsh=ssh" scpresume archivo_origen usuario@hosts-destino:/path_destino
-
∞ run banshee from ssh session
#!/bin/sh # run banshee from ssh session & auto play queque export DISPLAY=:0 dbus-launch /usr/bin/banshee --play
-
∞ Mailbox Plesk Diskusage
cd /var/qmail/mailnames/; du -sh */* -
∞ Moving Magento to another server (the backup part)
#!/bin/bash clear stty erase '^?' echo "-- File and DB Backup of Magento --" echo "The moving an installation of Magento as written on http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server" echo "Please note: It does not backup all the extensions and additional plugins. Back up all the files you added or changed manualy." echo check_dest_dir () { echo -n "Please enter the name of the directory the backup files will be stored in: " read dest_dir if [ -d "$dest_dir" ]; then echo -n "Directory already exists. Use it for Backup [y] or specify another one [n]?" read use_dest_dir; if [ "$use_dest_dir" = "y" ] ; then do_backup $dest_dir; else check_dest_dir; fi else echo -n "Directory does not exist. Create it [c] or specify another one [n]?" read use_dest_dir if [ "$use_dest_dir" = "c" ] ; then echo "Directory /"$dest_dir/" is to be created..." mkdir $dest_dir; do_backup $dest_dir; else check_dest_dir; fi fi } do_backup(){ clear echo -n "Do the DATABASE dump? [y/n]" read do_database_dump if [ "$do_database_dump" = "y" ] ; then echo "Please enter the required information:" echo -n "- Database Host (usually localhost): " read dbhost echo -n "- Database Name: " read dbname echo -n "- Database User: " read dbuser echo -n "- Database Password: " read dbpass echo "Creationg database DUMP. Please wait..." mysqldump -h DBHOST -u DBUSER -pDBPASS DBNAME > data.sql echo "Moving data.sql to your backup directory ($1)" mv data.sql $1/ fi clear echo "TARing MEDIA..." tar -cvf media.tar media/* echo "Moving media.tar to your backup directory ($1)" mv media.tar $1/ clear cd app/design/frontend/default/ echo -n "About to TAR your Theme. What's the name of it?" read mytheme if [ -d "$mytheme" ]; then echo "Specified Theme Directory exists. TARing from app/ ..." tar -cvf app.tar $mytheme/ echo "Moving app.tar to your backup directory ($1)" mv app.tar ../../../../$1/ echo "TARing from skin/..." cd ../../../../skin/frontend/default/ tar -cvf skin.tar $mytheme/ echo "Moving skin.tar to your backup directory ($1)" mv skin.tar ../../../$1/ fi clear echo "Copying local.xml to your backup directory ($1)" cd ../../../ cp app/etc/local.xml $1/ echo "Copying .htaccess and php.ini to your backup directory ($1)" cp .htaccess php.ini $1/ clear cd $1 echo "Files in your backup:" ls } check_dest_dir;
-
∞ ssh port forwarding
#This forwards all localhost:1234 connections to google.com:80 through gimli ssh -L 1234:google.com:80 gimli.cs.berkeley.edu
-
∞ ssh rate limit iptables
$/usr/sbin/iptables -I INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --set $/usr/sbin/iptables -I INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --update --seconds 1000 --hitcount 2 -j DROP
-
∞ how to create a git repo on a server under msysgit on windows
cd /e/language/Project/src git init vim .gitignore # *.pyc, *~ git add .gitignore # ... git commit -m "Initial commit" cd ../.. # /e/language git clone --bare Project/src project.git scp -r -P 1234 project.git user@192.168.0.1:~/git/language # delete 'Project' in Eclipse git clone ssh://user@192.168.0.1:1234/~/git/language/project.git project/src # recreate 'project' in Eclipse
-
∞ Deploying a CakePHP App on a Media Temple (dv) 3.5 Server using a Subdomain
USE: Deploy a CakePHP App to mysubdomain.example.com NOTE: Looking to deploy on a regular domain like example.com? See: http://snipt.net/chrisyour/deploying-a-cakephp-app-on-a-media-temple-dv-35-server/ STEP 1: SET UP DOCUMENT ROOT VIA SSH # TERMINAL: login to SSH as root (and enter your password) ssh root@example.com # TERMINAL: change directory to the conf folder (example.com) cd /var/www/hosts/example.com/subdomains/mysubdomain/conf # TERMINAL: use Vim (vi) to create your vhost.conf file vi vhost.conf # VIM: Press the 'i' key to begin inserting content # VIM: Type in the document root into Vim DocumentRoot "/var/www/vhosts/example.com/subdomains/mysubdomain/httpdocs/app/webroot" # VIM: Press 'esc' key once you're finished inserting content # VIM: Type ':wq' then press 'return' key to write to the vhost.conf file and quit Vim STEP 2: RECONFIGURE VHOST # Terminal: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mysubdomain.example.com # Terminal: Restart Apache service httpd graceful STEP 3: MIGRATE YOUR DEVELOPMENT DATABASE TO YOUR PRODUCTION ENVIRONMENT # Dump your local database into a .sql file on your computer # Login to Plesk and use PHPMyAdmin to import your .sql STEP 4: UPLOAD YOUR CAKEPHP FILES # Using FTP software (like Transmit), upload all the files in your CakePHP application to: /var/www/vhosts/example.com/subdomains/mysubdomain/httpdocs # Don't forget to upload your .htaccess files. Your FTP software may treat them as hidden files and skip them in the upload process. (If you're using Transmit, select View -> Show Invisible Files to make sure they are uploaded.) # Don't forget to update your app/config/database.php file so your app will connect to the production database. STEP 5: FIRE IT UP # Point your browser to http://mysubdomain.example.com
-
∞ Deploying a CakePHP App on a Media Temple (dv) 3.5 Server
USE: Deploy a CakePHP App to example.com NOTE: Looking to deploy on a subdomain like mysubdomain.example.com? See: http://snipt.net/chrisyour/deploying-a-cakephp-app-on-a-media-temple-dv-35-server-using-a-subdomain/ STEP 1: SET UP DOCUMENT ROOT VIA SSH # TERMINAL: login to SSH as root (and enter your password) ssh root@example.com # TERMINAL: change directory to the conf folder (example.com) cd /var/www/hosts/example.com/conf # TERMINAL: use Vim (vi) to create your vhost.conf file vi vhost.conf # VIM: Press the 'i' key to begin inserting content # VIM: Type in the document root into Vim DocumentRoot "/var/www/vhosts/example.com/httpdocs/app/webroot" # VIM: Press 'esc' key once you're finished inserting content # VIM: Type ':wq' then press 'return' key to write to the vhost.conf file and quit Vim STEP 2: RECONFIGURE VHOST # Terminal: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com # Terminal: Restart Apache service httpd graceful STEP 3: MIGRATE YOUR DEVELOPMENT DATABASE TO YOUR PRODUCTION ENVIRONMENT # Dump your local database into a .sql file on your computer # Login to Plesk and use PHPMyAdmin to import your .sql STEP 4: UPLOAD YOUR CAKEPHP FILES # Using FTP software (like Transmit), upload all the files in your CakePHP application to: /var/www/vhosts/example.com/httpdocs # Don't forget to upload your .htaccess files. Your FTP software may treat them as hidden files and skip them in the upload process. (If you're using Transmit, select View -> Show Invisible Files to make sure they are uploaded.) # Don't forget to update your app/config/database.php file so your app will connect to the production database. STEP 5: FIRE IT UP # Point your browser to http://example.com
-
∞ ssh login auf port 1234 als user auf rechner 192.168.0.1
ssh -p 1234 user@192.168.0.1
-
∞ Mount SSH volume on Mac with sshfs
# With sshfs installed: MOUNTPOINT=/Volumes/mountdir REMOTE=user@hostname:/home/dir OPTIONS=-oping_diskarb,volname=mountdir TESTHOST=hostname #test if sshfs already mounted if ! [ -e $MOUNTPOINT ] then #test if connected to internet if ! [ -z "`ping -c 1 $TESTHOST 2>/dev/null | grep "time="`" ] then mkdir $MOUNTPOINT sshfs $REMOTE $MOUNTPOINT $OPTIONS echo "$REMOTE mounted on $MOUNTPOINT" else echo "Network down, unable to mount $REMOTE" fi fi
-
∞ Change SSH port on OS X
# Add a service on an unused port in: sudo vim /etc/services # Change the string "ssh" below "SockServiceName" to whatever name used in the above file sudo vim /System/Library/LaunchDaemons/ssh.plist
-
∞ ssh local mount
sshfs remote-username@192.168.1.10:/remote/dir /local/dir
-
∞ Locally backup remote files via ssh
ssh remote-login@192.168.1.10 "cd /; tar -cvf - / | gzip -c" > backup.tar.gz
-
∞ Mount remote directory locally via sshfs
sshfs remote-username@192.168.1.10:/remote/dir /local/dir



MySQL Cookbook