This topic provides a solution to the stuttering issue that occurs when you connect to a Linux Elastic Compute Service (ECS) instance over SSH.
Problem description
After you enter the username and password, stuttering occurs before you can access the system. During this stuttering period, you can press Ctrl+C to bypass the stuttering and enter the instance.
Causes
The stuttering may be caused by exceptions or updates in the following files, which cause the system to load environment variables for an extended period of time:
Global environment variable configuration file:
/etc/profilePersonal environment variable configuration files:
$HOME/.bash_profile$HOME/.bashrc
The
$HOMEenvironment variable is automatically set to the home directory of the current logon user. For example, the value of the environment variable is/home/ecs-userfor theecs-useruser and/rootfor therootuser.To view the value of
$HOME, run theecho $HOMEcommand on the terminal.
Solution
Run the following commands to view the revision times of the environment variable configuration files and determine whether the files have been updated recently:
ls -l $HOME/.bash_profile ls -l $HOME/.bashrc ls -l /etc/profileIf the revision time of a file is recent, the file may have been updated recently. We recommend that you view the file content.
Run the following commands to view the file content and find the abnormal content that may cause the stuttering:
cat $HOME/.bash_profile cat $HOME/.bashrc sudo cat /etc/profileIf a file contains complex scripts such as loops and conditional statements, network requests such as
curlandwget, or dynamic path loading such asexport PATH=$(some_command), proceed to the next step.If the file content is normal (for example, if the files contain only simple environment variable settings), proceed to Step 7 to reload the files.
Run the following commands to open the environment variable configuration files.
Personal configuration files:
vi $HOME/.bash_profile vi $HOME/.bashrcGlobal configuration file:
sudo vi /etc/profile
Comment out the updated content.
Press the
Ikey to edit the file content and add a number sign (#) before the updated content to comment it out. Example:# export PATH=$PATH:/some/path # curl https://example.comPress the
Esckey, enter:wq, and then press theEnterkey to save and exit the configuration files.Run the following commands to reload the configuration files for the environment variables to take effect.
Personal configuration files:
source $HOME/.bash_profile source $HOME/.bashrcGlobal configuration file:
Switch to the root user.
sudo -iReload the global configuration file.
source /etc/profileExit from the root user.
exit
Reconnect to the ECS instance to verify that the stuttering issue is resolved.
Uncomment the lines that you commented out one by one to restore them.
Each time you uncomment a line, repeat Step 7, reload the corresponding configuration file, and then reconnect to the ECS instance to check whether the stuttering issue recurs.
If the stuttering issue recurs after you uncomment a line, the content in the line causes the issue. Recommended optimizations or solutions:
Remove unnecessary network requests.
Optimize complex scripts.
Modify dynamic path loading settings.