Creates the .ssh directory on the remote host with proper permissions, if it doesnt exist. Appends your public key to authorized_keys, and verifies it has proper permissions. (if it didnt exist it may have been created with undesireable permissions). *Korn shell syntax, may or may not work with bash
pub key in ./ssh/authorized_keys needed because ssh-ed ssh can't ask for the password.
analyze traffic remotely over ssh w/ wireshark When using tcpdump, specify -U option to prevent buffering and -iany to see all interfaces. Show Sample Output
Neat idea! This variation works on FreeBSD.
Now at the end of the rsa.pub file, there is our comment like= ".................peXeuE0ytJgpQcXeR5aHlfLa8dAt0obasd hello@world"
If you have a lot of hosts in /etc/hosts this would be very useful. Anyone have any more concise examples?
Tomcat webapps are often remote links
This may be listed already but this command is useful to untar a specific directory to a different server.
Nice command for when you don't have scp available for whatever reason. Works with binaries.
host -i `echo $SSH_CLIENT | cut -f 1 -d \ ` | sed 's/.* domain name pointer \(.*\)\./\1/'
to reverse lookup and get the hostname.
Kills all process that belongs to the user that runs it - excluding bash, sshd (so putty/ssh session will be spared). The bit that says grep -vE "..." can be extended to include ps line patterns that you want to spare. If no process can be found on the hitlist, it will print # NOTHING TO KILL. Otherwise, it will print # KILL EM ALL, with the cull list.
Gets the latest podcast show from from your favorite Podcast. Uses curl and xmlstarlet. Make sure you change out the items between brackets.
Ever wanted to stream your favorite podcast across the network, well now you can. This command will parse the iTunes enabled podcast and stream the latest episode across the network through ssh encryption. Show Sample Output
I was tired of the endless quoting, unquoting, re-quoting, and escaping characters that left me with working, but barely comprehensible shell one-liners. It can be really frustrating, especially if the local and remote shells differ and have their own escaping and quoting rules. I decided to try a different approach and ended up with this.
In some case, you need to use remote gui on servers or simple machines and it's boring to see "cannot open display on ..." if you forgot to export your display. Juste add this line in .bashrc on remote machine. Dont forget to allow remote client on your local X server :
xhost +
Create tarball on stdout which is piped to tar reading from stdin all over ssh
Required: 1) Systems that send out alert emails when errors, database locks, etc occur. 2) a system that: a) has the ability to receive emails, and has procmail installed. b) has ssh keys set up to machines that would send out alerts. When procmail receives alert email, you can issue a command like this one (greps and awks may very - you're isolating the remote hostname that had the issue). This will pull process trees from the alerting machines, which is always useful in later analysis. Show Sample Output
when someone mail you his ssh public key, and the lines are broken with '\n', you can reconstruct a new file with one key by line with this command. Show Sample Output
Check the ssh_config file and set the variable: StrictHostKeyChecking no
if you lost your moduli file in openssh server side you need generate new one with this command then test if the number generated can be used with ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates
Well its just appending your public key to the remote hosts authorized_keys, but can get messy logging in and out
Stop tormenting the poor animal cat! Also you should not that you need a private key not protected by a passphrase on middlehost that grants you access to securehost..
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: