RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

Executing commands remotely with ssh and output redirection

ssh command can by used to remotely login to a server running sshd daemon. This allows linux administrators to perform variety of administrative jobs. However, ssh is more powerful than just providing a user with remove shell access, it can also be used to automate remote command executions, running simple backups and download the backup file locally. Here are couple examples:
The following ssh command can be used to to create a file remotely:

ssh user@ssh-server.com '( cd /tmp/ && touch ssh_file.txt )'

Make a local copy of a remote /etc/passwd file to /tmp/passwd:

ssh user@ssh-server.com '( cat /etc/passwd )' > /tmp/passwd

Execute a script on the remote server with ssh:

NOTE: we assume that the script exists, is executable and you have executable permissions

ssh user@ssh-server.com '( cat ~/myscript.sh )' 

In this example we make a bzip2 local copy of /var/log/auth.log file to a local /tmp/ direcotry:

ssh user@ssh-server.com '( cp /var/log/auth.log /tmp/; cd /tmp/ && tar -jcvf - auth.log )' > /tmp/auth.tar.bz2

Share this linux post:

Submit Executing commands remotely with ssh and output redirection in Delicious Submit Executing commands remotely with ssh and output redirection in Digg Submit Executing commands remotely with ssh and output redirection in FaceBook Submit Executing commands remotely with ssh and output redirection in Google Bookmarks Submit Executing commands remotely with ssh and output redirection in Stumbleupon Submit Executing commands remotely with ssh and output redirection in Technorati Submit Executing commands remotely with ssh and output redirection in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download