📅  最后修改于: 2023-12-03 15:20:20.199000             🧑  作者: Mango
SSH (Secure Shell) is a network protocol that allows secure remote access over an unsecured network. It is used by programmers and system administrators to login to remote servers for different purposes such as file transfers, running commands, and managing the server.
Bash is a default shell in most Linux and Unix systems. It is a powerful command-line interface that allows users to run complex commands and scripts. When you login to a remote server via SSH, you will be greeted by a bash prompt.
To login to a remote server via SSH, you need to have the server's IP address or domain name, username, and password. Once you have this information, you can use the following command to login:
ssh username@ip_address
Where username
is the username of the remote server and ip_address
is the IP address or domain name of the server. If you are using the default SSH port (22), you don't need to specify the port number. However, if you are using a different port, you can specify it using the -p
option:
ssh -p port username@ip_address
Where port
is the port number.
When you run this command, you will be prompted for the password of the remote user. Once you enter the correct password, you will be logged in to the remote server.
When you login to a remote server via SSH, you will be greeted by a bash prompt. This prompt tells you that you are now in a bash shell and ready to run commands. The default prompt looks like this:
username@hostname:~$
Where username
is your username, hostname
is the name of the server, and ~
is your home directory.
You can customize your bash prompt by defining the PS1
environment variable. This variable contains the format string for the prompt. For example, to change the prompt to display the current directory, you can use the following command:
PS1='\u@\h:\w$ '
Where \u
is the username, \h
is the hostname, and \w
is the current directory.
In summary, SSH login via shell bash is a powerful tool for programmers and system administrators to manage remote servers. It allows secure remote access and provides a powerful command-line interface to run complex commands and scripts. By understanding how to use SSH login, and customize the bash prompt, you can make your remote server management tasks easier and more efficient.