PuTTY closes after login

9,203

Solution 1

It seems as though your .profile file has become corrupted, and is preventing your account from logging in.

This will likely require you to contact your system administrator to fix the file.

I've looked through a few "How to bypass .profile on login" articles, and though I don't have access to PuTTY to see if these flags can be set somehow, specifying bash --noprofile as the remote command might allow you to login.

Someone also reported that they were able to regain control by sending Control-C during the login process.

Should you be able to get access to your account this way, you may wish to run

mv .profile .profile-copy

so you can get back into your account without trickery in the future.

Solution 2

Try to copy the .profile from the remote using pscp.exe, for backup:

pscp user@host:.profile .profile.bak

And then replace it with an empty file:

echo > empty
pscp empty user@host:.profile

As a sanity check, try to login again using PuTTY. With the new empty .profile, it should work. Then edit the copy of .profile locally, try to fix the errors, and copy it back to the server. Repeat until all problems in .profile are resolved (you successfully log in).

Share:
9,203

Related videos on Youtube

Jakuje
Author by

Jakuje

Red Hat Employee -- OpenSSH maintainer -- OpenSC developer -- Seasonal web (applications) developer -- Open Source religion -- Security enthusiast -- Linux fan Aug 2017: No longer active. After more than 2 years of actively answering questions here, it is time for a pause. I hope I helped people with more than 2000 answers across the sites, I learned what are the common problems of users using the tools I have something in common or I was just interested in. If you want to contact me, I have the contacts on my blog. Achievements: badges: Dec 2020: on Stackoverflow Jan 2022: on Unix&Linux badges: Dec 2016: on Unix&Linux Mar 2017: on Stackoverflow May 2018: on ServerFault Aug 2019: on SuperUser badges: Dec 2015: on Unix&Linux Feb 2016: on ServerFault Mar 2016: on StackOverflow Mar 2016: on SuperUser Aug 2016: on Security Nov 2016: on Ubuntu badges: Dec 2016: on SuperUser Jun 2017: on StackOverflow badge: Jun 2016: on Unix&Linux badge: Jul 2017: on Unix&Linux Aug 2017: on StackOverflow badge: Aug 2017: on Unix&Linux Jun 2019: on Security bronze git badge: Aug 2017: on StackOverflow bronze scp badge: Sep 2020: on StackOverflow

Updated on September 18, 2022

Comments

  • Jakuje
    Jakuje almost 2 years

    I'm logging in through my schools host and everything works fine, I exited earlier and now anytime I try to log back in, PuTTY automatically closes. I also used the Google Shell to see if it was an issue with PuTTY but I still get logged out. Here is the output I get:

    Last login: Tue Feb 14 21:51:02 2017 from rsrch-bd09s72.ucads.uc.edu
    /home/ep69674/.profile[3]: Class: not found [No such file or directory]
    /home/ep69674/.profile[7]: 1.: not found [No such file or directory]
    /home/ep69674/.profile[14]: 2.: not found [No such file or directory]
    /home/ep69674/.profile[15]: what: not found [No such file or directory]
    /home/ep69674/.profile[22]: 3.: not found [No such file or directory]
    /home/ep69674/.profile[29]: 4.: not found [No such file or directory]
    /home/ep69674/.profile[32]: ________________: not found [No such file or directory]
    /home/ep69674/.profile[36]: 5.: not found [No such file or directory]
    /home/ep69674/.profile: line 36: syntax error: `(' unexpected
    Connection to rwclinux.rwc.uc.edu closed.
    NaCl plugin exited with status code 3.
    

    Side note: I'm also using SSH

  • Martin Prikryl
    Martin Prikryl over 7 years
    To specify the remote command, go to Connection > SSH > Remote Command.