# Linux Connect
There are two ways to connect to a Linux server: command line and SFTP:
# Connect by Command
The Command is the basic operation of the Linux system. HUAWEI CLOUD provides two web-based SSH tools that can be logged in without an account.
Log in to the HUAWEI CLOUD Console, open the ECS -> Operations, click "Remote Login"
If you are not used to using the online SSH command line tool provided by the cloud platform, download the SSH client tool (e.g putty (opens new window)), configure the login information and then connect to Linux.
After connecting to the server through the command line, the following two most common examples of operations are required:
# Sample1: Getting database password
For security reasons, each time a user deploys, a unique random database password is generated and stored in the service. Just one of the following commands to view
cat /credentials/password.txt //result MySQL username:root MySQL Password:@qDg1Vq1!V
# Sample2: Enable the root username
For security and regulatory requirements, AWS does not open the Linux root account by default, and only provides users with a common account. If you wish to use the root account, enable it by following the steps below:
sudo su sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config sudo systemctl restart sshd sudo passwd root
# Connect by SFTP
SFTP is an FTP mode that uses the SSH protocol, also known as security-enhanced FTP. The SFTP tool is a favorite operation mode for Linux users. The following is an example of WinSCP SFTP tool, which details the use of SFTP.
# Configure WinSCP
- Download WinSCP (opens new window) and install it, then start it to create a new connection
- The following is based on the cloud server's password verification and key-key pair verification:
- Password authentication(the most common way)
- Key-key pair authentication
- You may want to save your session details to a site so you do not need to type them in every time you want to connect. Press Save button and type site name.
- Successfully connected interface
# Manage Files
WinSCP can easily upload and download files by dragging and dropping, and can perform various settings and operations on files (folders).
In general, the files on the website are placed in the /data/wwwroot directory.
You can perform multiple operations on the VM by right-clicking on a file or folder on the server.
The relevant interface for modifying file permissions is as follows:
# Run Command
WinSCP is a built-in command run function, although the command function is limited to running non-interactive naming (that is, no feedback and process input are required during command execution), but it is simple and practical for beginners.
- WinSCP logs in to the server, click on the command window icon from the menu (shortcut Ctrl+T is also available)
- In the pop-up command run window to execute the command (one command at a time), to query the memory usage as an example, run the command
# Putty Integration
Under certain specificities, you may need to use Putty (opens new window) to run commands. Since Putty is a command operation interface, you need to enter the root password every time you use it. If the password is complicated, it will make people feel more troublesome. In fact, WinSCP can be integrated with Putty. After integration, you can open Putty through WinSCP and log in to the server automatically.
- Open the Preferences of WinSCP->Integration->Application, and input the local address of your Putty, click OK
- After the integration is successful, you only need to open the Putty through Winscp's window shortcut.
Opening a Putty operation via Winscp is no different than opening a putty directly.