I am trying to login with regular user over ssh. User login successfully. But user bash not loaded properly. I am getting the below message on my login screen

Last login: Mon Jul 27 01:12:45 2020 from xx.xxxx.xxxx
-bash: /root/.bash_profile: Permission denied

How can I solve this problem? Also I want to know what is the relation between regular user login with super user /root/.bash_profile

  • 2
    Something your regular user is processing is trying to source /root/.bash_profile. A regular user can't access that file. Jul 26, 2020 at 19:28
  • I am also facing E138: Can't write viminfo file /root/.viminfo! issue when regular user try to write any file with vim editior
    – Rakib
    Jul 26, 2020 at 20:36
  • @AndyDalton I want to know the root cause why regular user is trying to source /root/.bash_profile
    – Rakib
    Jul 26, 2020 at 20:39
  • 2
    Have you explicitly set ${HOME} to /root somewhere? Jul 26, 2020 at 20:39
  • 1
    @AndyDalton thanks for your feedback. Finally resolved the issue. One background application write some env variable on /etc/environment file that override ${HOME} to root
    – Rakib
    Jul 28, 2020 at 12:14

1 Answer 1


Given that multiple applications are looking for artifacts in root's home directory, that suggests that something has explicitly set the HOME environment variable to /root. As a result, processes trying to process ${HOME}/.their_resource are getting /root/.their_resource instead of the version in your home directory.

If there is somewhere that's explicitly setting HOME=/root, removing that should resolve the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .