ru en
Help
Print version

SSH — access and program setup

Contents

1. General information
2. Information for connection
3. Working with hosting using Midnight Commander
4. Work with hosting from command line

1. General information

SSH (Secure SHell) — is a network protocol enabling connection with the remote server and running commands on it, uploading files and creating tunneling of TCP connections. The key feature is encryption of the transmitted data. By default, command interpreter bash is implemented on hosting.

2. Information for connection

The information for connection to server through SSH and SFTP can be viewed at "Web server" — "Access management" — "SSH" of the control panel (https://www.r01.ru, section "Account manager").

  • Server address (host): ssh.identifier.r01host.ru — specified in "Domain names" block.
  • "Identifier" is a unique name of the hosting service that is specified in the top part of the control panel next to the agreement number.
  • Name of SSH user (login): identifier.
  • To obtain password of SSH user click on "Change password". New password will be displayed on the screen. To send password to your email contact address, check "Specify password in letter".

For connection to the hosting server via SSH, install ssh-client on your computer.

  • Configuration of PuTTY ssh client

To upload files on hosting use SFTP client.

  • Access to virtual server through SFTP

3. Working with hosting using Midnight Commander

Midnight Commander is a two-panel file manager. It has a built-in text editor.

To run Midnight Commander connect to hosting via SSH and enter command

mc

Basic hot keys:

  • F1: Help;
  • F3: Built-in file viewer;
  • F4: Built-in text editor;
  • F5: Copy file;
  • F6: Remove (rename) file;
  • F8: Delete file;
  • F9: Display drop-down menu;
  • F10: Program exit;
  • Tab: Switching between panels;
  • Insert: Check file for operations with several files, for example, for copying

4. Work with hosting from command line

4.1. Help

To get help about command of interest in command line enter:

man command

to finish work with the help click on "q".

The brief note about the command may be received by running it with setting --help or -h:

command --help

4.2. Moving along file system

Display current directory:

pwd

Go to user home directory:

cd

Go to tmp directory located in the current directory:

cd tmp

Go to directory by full path /home/login/sitename.ru/docs (root directory of website name.ru):

cd /home/login/sitename.ru/docs

Go to parent directory (on a higher level):

cd ..

Go to previous directory:

cd -

4.3. Viewing directory contents

Display contents of the current directory (except for hidden files):

ls

Display all contents of the current directory with the detailed information:

ls -la

Display all contents of tmp directory with the detailed information:

ls -la tmp

Display size of tmp directory:

du -sh tmp

4.4. Creation and deletion of files and directories

Create new directory foo in the current directory:

mkdir foo

Create structure of directories foo/bar/baz in the current directory:

mkdir -p foo/bar/baz

Delete directory foo in the current directory. The directory shall be empty:

rmdir foo

Delete directory foo with all files and subdirectories:

rm -rf foo

Create blank file foo:

touch foo

Delete file foo:

rm foo

4.5. Viewing and editing file contents

View the contents of the text file (log-file of the website) (Click "q" to exit):

less sitename.ru/logs/access_log

Open file foo in text editor:

mcedit foo

4.6. Copying and moving files

Copy file foo into file bar:

cp foo bar

Copy the contents of directory "old" into directory "new":

mv old/* new/

Rename file foo to file bar:

mv foo bar

Move file foo to existing directory bar under baz name:

mv foo bar/baz

4.7. Changing access rights

Recommended access rights on hosting for files 644 (rw-rw-rw-), for directories 755 (rwxr-xr-x).

Make file foo executable:

chmod 755 foo

Make file foo read-only:

chmod 444 foo

Changing access rights for all directories, contained in directory foo on 755:

find foo -type d -exec chmod 755 {} \;

Changing access rights for all directories, contained in directory foo on 644:

find foo -type f -exec chmod 644 {} \;

4.8. Processes management

Show information about processes in real time (Press "q" to exit):

top

Show detailed information about all processes in progress:

ps auxww

Finish process work by its process identifier (PID) 1234:

kill 1234

Finish process work by its name:

killall httpd

Restart Apache server::

~/etc/rc.d/httpd restart

Restart Nginx server:

~/etc/rc.d/nginx restart

4.9. Work with archives

Create archive of docs directory:

tar -czf archive.tar.gz docs

Unpack archive.tar.gz:

tar -xzf archive.tgz

Unpack archive.zip:

unzip archive.zip

Unpack archive.rar:

unrar x archive.rar

Unpack archive.gz:

gunzip archive.gz

4.10. Files search

Among website files find those containing text "login.mysql" (server address to access database):

grep -R "login.mysql" sitename.ru/docs

Find in the current directory and subdirectories files index.php:

find . -name index.php

Copyright © 2000-2024 Registrar R01
Information: info@r01.ru
Support: support@r01.ru
Office: 1 Bolshoy Gnezdnikovsky Lane, building 2, Moscow (Tverskaya metro station, entrance No. 9, Voznesensky business center)