You are viewing the article How to Use SSH at Lassho.edu.vn you can quickly access the necessary information in the table of contents of the article below.
wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 20 people, some of whom are anonymous, have edited and improved the article over time.
This article has been viewed 1,768 times.
If you’re connecting to another computer over the network, you probably want to keep your data safe. And SSH is a viable option. To do that, you need to properly set up SSH on your computer and then create an encrypted connection to the server. Also, SSH needs to be enabled on both ends of the connection. Follow the instructions below to secure your connection.
Steps
Connecting for the first time
- During the installation of Cygwin, you must choose to install OpenSSH from the Net section.
- Linux and Mac OS X have SSH available. That’s because SSH is a UNIX system and Linux and OS X are both developed from this system.
- If you are using Windows 10 with the Anniversary Update, you can install Windows Subsystem for Linux: with this feature, SSH will be pre-installed.
-
$ ssh <tên_người_dùng>@<thiết_bị_từ_xa>
- Once the connection is established, you will be asked to enter a password. As you type, the cursor will not move and any entered characters will not be displayed.
- If you fail at this step, SSH is either misconfigured on your computer or the computer on the other end is not accepting SSH connections.
Learn Basic Commands
cd
command: [1] X Research Sources
-
cd ..
move to the directory right ahead in the directory tree -
cd <tên_thư_mục>
to which specific directory. -
cd /home/tên_thư_mục/đường_dẫn/
move to specific directory from the root directory (home). -
cd ~
return to your HOME directory.
ls
: [2] X Research Sources
-
ls
lists every directory and file in the current directory. -
ls –l
lists the contents of the directory with additional information such as size, permissions, and date. -
ls-a
lists all the contents, including hidden files and folders.
scp
command:
-
scp /thư_mục_cục_bộ/ví_dụ_1.txt <tên_người_dùng>@<thiết_bị_từ_xa>:<đường_dẫn>
will copy instance_1.txt to the specific <path> on the computer being accessed remotely. You can leave the <path> field blank to copy to the root directory of this computer. -
scp <tên_người_dùng>@<thiết_bị_từ_xa>:/home/ví_dụ_1.txt ./
will move instance_1.txt from the home directory on the remote access computer to the directory you are entering directly on this terminal.
cp
command to copy files in the same directory or to a specified directory:
-
cp ví_dụ_1.txt ví_dụ_2.txt
will make a copy of example_1.txt and name it example_2.txt right in the current directory. -
cp ví_dụ_1.txt thư_mục/
will create a copy of example_1 in the directory specified by directory.
mv
command:
-
mv ví_dụ_1.txt ví_dụ_2.txt
will rename example_example_1.txt to example_2.txt, the file is still in the old directory. -
mv thư_mục_1 thư_mục_2
rename folder_1 to folder_2. The contents of the folder remain unchanged. -
mv ví_dụ_1.txt thư_mục_1/
move example_1.txt to folder_1. -
mv ví_dụ_1.txt thư_mục_1/ví_dụ_2.txt
move example_1.txt to folder_1 and rename it to example_2.txt.
rm
command:
-
rm ví_dụ_1.txt
deletes file named example_1.txt. -
rm –I ví_dụ_1.txt
delete file example_1.txt after getting confirmation from you. -
rm thư_mục_1/
deletes directory_1 and all its contents.
chmod
command:
-
chmod u+w ví_dụ_1.txt
adds write (modify) file permission to user (u). You can also use theg
plugin for group permissions ando
for world permissions. -
chmod g+r ví_dụ_1.txt
adds file read (access) permission to the group. - The list of commands that you can use to secure or open various aspects of your machine is quite long. [3] X Research Sources
-
mkdir thư_mục_mới
creates a subdirectory called new_directory. -
pwd
shows the current directory location. -
who
displays who is logged into the system. -
pico newfile.txt
orvi newfile.txt
create a new file and open the file editor. Different machines may have different file editors installed. Pico and vi are the two most popular. In case your computer uses a different file editor, you may have to use other commands.
man
command to learn about all the parameters and possible uses:
-
man <lệnh>
displays information about that command -
man –k <từ_khóa>
finds all command pages for the specified keyword. [4] X Research Sources
Generate encrypted key
- Create a locked directory on your computer by entering the command
$ mkdir .ssh
- Generate private and public keys using the command
$ ssh-keygen –t rsa
- You will be asked if you want to create a password for the key: it is optional. If you don’t want to create a password, just press Enter. The two keys id_rsa and id_rsa.pub will be generated in the .ssh directory.
- Change private key permissions. To make sure that only you can read the private key, enter the command
$ chmod 600 .ssh/id_rsa
-
$ scp .ssh/id_rsa.pub <tên_người_dùng>@<thiết_bị_từ_xa>:
- Don’t forget the colon (:) at the end of the command.
- You will be asked to enter a password before starting the file transfer.
- Create an SSH directory if it doesn’t already exist on this computer:
$ mkdir .ssh
- Mount your key with the licensed key file. If this file does not exist, it will be initialized:
$ cat id_rsa.pub >> .ssh/authorized_keys
- Change SSH directory permissions to allow access:
$ chmod 700 .ssh
$ ssh <tên_người_dùng>@<thiết_bị_từ_xa>
- If you don’t have to enter a password when connecting, the key is configured correctly.
wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 20 people, some of whom are anonymous, have edited and improved the article over time.
This article has been viewed 1,768 times.
If you’re connecting to another computer over the network, you probably want to keep your data safe. And SSH is a viable option. To do that, you need to properly set up SSH on your computer and then create an encrypted connection to the server. Also, SSH needs to be enabled on both ends of the connection. Follow the instructions below to secure your connection.
Thank you for reading this post How to Use SSH at Lassho.edu.vn You can comment, see more related articles below and hope to help you with interesting information.
Related Search: