With the widespread use of ready-made PHP scripts such as WordPress, Joomla, and so forth. We should consider the concept of SSH, the invariant Linux structure that has begun to attract more attention.
What is SSH?
SSH is a security-enhanced program structure that is configured as an alternative to TELNET when connected to UNIX servers. The concept of SSH includes “Secure Shell Client” for command operations and “Secure File Transfer Client” for file transfers. On this point, SSH can log into a remote machine and perform the machine administration with command requests.
How to Use SSH
To be able to use SSH on a remote or local device, “OpenSSH” IN must be installed on the device. In general, many UNIX operating systems provide the OpenSSH service to the end user. UNIX and SSH users prefer using PUTTY program to manage the remote device. In the following article, we will briefly go over how SSH connections are made while using the PUTTY program and go over the most commonly used commands when performing server administration via SSH.
If you have finished downloading and installing Putty program, you are now able to access into your remote server. As you can see on the screenshot below, we are writing the remote server IP address in the Host Name field on the putty screen.
On UNIX servers, SSH port 22 is the default. However, users can change the standard port by configuring the UNIX security configuration. We will continue our tests based on port 22.
We perform SSH access by typing the local or remote server IP address and the server’s port. When we click Open, a window will appear and will ask you to enter your user name and password for your server.
Depending on whether we have access to our remote or local server, we can consider the most commonly used command lines to manage the Unix structure. The commands I share below will suffice to perform initial server administration.
cd: Command to help you navigate through the directory. The sample command line is below.
cd/var/log/httpd/
The command I share will help you access the /var/log/httpd/directory with cd.
Ls: Delete all files in the directory. Now, we can use the LS command together with the command shared in the previous example.
You can access the directory with cd /var/log/httpd/, and in the next step you can list all the contents in the list with hidden files by entering ls -a .
In addition, other SSH commands that you might find useful are listed below.
mkdir: Creates a new folder with the name you specify as parameter.
touch: Creates a new file with the name you specify as parameter.
rm: Delete the file.
rmdir: Delete the specified folder.
tail: Used to display the last few lines of a text file. Tail -f When you specify a log file as a parameter, you can watch the contents of the log file live.
nano: File editing editor. When using nano to edit files nano can open /etc/php.ini . But one thing that should not be forgotten; When you process any conf file with putty, putty can save it as it appears on its screen. This will cause the code you are writing to be passed to the bottom line and your conf file to be corrupted. To avoid this difficult problem, you can use nano -w as a file .
service: Used to launch server services, query status, close. (restarts the service httpd restart apache service)
ps: It is useful to see applications running on the server, ps command has many parameters.
Parameters of PS Command
kill: stops the operation given by the PID number.
KillAll: Closes the specified application with all running applications.
kill -6: stops the eggdrop operation given the PID number.
who: View the users connected to the server.
uname: Indicates the kernel version of the operating system.
whoami: Show your own information.
df: Displays hard disk statistics.
df -i: Displays the inode list on the system.
watch: Allows the command you specify within the quotation to run continuously.
whatis: Allows the specified command to be opened.
scp: Allows you to transfer files with SFTP or send commands on a different SSH.
ftp: You can use this command to make FTP connections and operations.
wget: Do not pull data from any URL address.
passwd: root will allow you to change your password and then ask you to enter your new password twice.
man: Displays help about the command.
reboot: Restart your server.
ShutDown: Your server is used for complex shutdown.
uptime: Shows the uptime and load status of your server.
tar: Used to compress files or open compressed files.