Библиотека сайта rus-linux.net
13.3. Remote Administration Related
- ssh
Secure shell, remotely login on a machine running the sshd daemon. Once you are logged in you have a secure shell and are able to execute various commands on that computer such as copy files, reboot the computer, just like it was your own GNU/Linux PC.
Or you can use ssh with a full hostname to connect to a remote machine (as in across the internet).
Examples:
ssh hostname
Connect to a remote system with your current username, you will obviously need the password of the user on the other machine.
ssh username@hostname
Connect to a remote system with your a different username, you will obviously need the password of the user on the other machine.
- scp
Secure copy, part of the ssh package. Allows you to copy files from one computer to another computer, use -r to copy recursively (copy entire directories and subdirectories).
scp's syntax is always
scp machineToBeCopiedFrom machineToBeCopiedTo
Where either machine can be a local directory (on the current filesystem /) or a remote machine. Remote machines are usually machinesFullName:/directory (if you omit the directory part it will just assume the home directory of the username you are logging in with).
The example below copies all files from the current directory (not including any directories), the command will login to “new” using the username of the person currently logged in on the local computer, the files will be copied to the root directory of the remote computer called “new” (which is probably on the LAN):
scp * new:/
You could also copy files from another computer to another computer. Let's say you are on a computer called “p100”. And you want to copy files (and directories) from “hp166” (in the /tmp directory and anything below that) to “new” and put the files in new's temporary directory. You could do:
scp -r hp166:/tmp new:/tmp
Assuming you were logged in as “fred” you would need passwords for user “fred” on the computers hp166 and new. Add an user_name@ before the computer name to login under a different user name.
For example to perform the above command with user “root” on hp166 and “anon” on new you would type:
scp -r root@hp166:/tmp anon@new:/tmp
To copy from a remote machine to a local computer you simply do things in reverse:
scp remoteMachine:/mystuff/* .
This will copy files on the remote machine in the directory “mystuff” to your local computer.
Remote Machines Please note that when working with a remote machine you need to have a : (colon) after the machine name even if you want the files in their home directory. Otherwise the command will fail.
- sftp
Secure ftp, another part of the ssh package. This command is similar to ftp but uses an encrypted tunnel to connect to an ftp server and is therefore more secure than just plain ftp.
The command usage is very similar to ftp (the command-line tool), sftp (once running) uses commands such as help (for help), put (send files to the server), get (download files from the server) and various others, refer to the manual page and internal documentation for further details.
Graphical programs Sometimes its easier to manage files with a GUI, many of these programs do have good GUI equivalents, try searching the internet or sites like Sourceforge or Freshmeat.