Give puTTY ROOT permissions?

7,427

This is why you should not ever run GUI applications as root.

PuTTY stores its configuration in ~/.putty, a hidden folder in your home directory. This directory and its contents are supposed to be owned by you.

If you run sudo putty, this will change the effective user id, but keep most of the current environment, including the home directory path. So all newly created files in that location will be owned by root instead of your user, and when you run putty normally next time, you won't be able to read them.

To fix this, restore your ownership of these files using the command

sudo chown -R $USER: ~/.putty

After that, keep in mind to not use sudo putty any more. There should never be a need to run this application with elevated privileges at all, I believe. However, if you need it for whatever reason, use sudo -H putty to make it use root's home directory /root instead of yours.

Share:
7,427
LinuxFerLife
Author by

LinuxFerLife

Updated on September 18, 2022

Comments

  • LinuxFerLife
    LinuxFerLife over 1 year

    Ubuntu 16.04, Acer laptop, i5, 6GB, 256SSD

    Hi, I need to SSH to my Pi so I installed puTTY. Unless I start puTTY via the terminal with sudo putty and then password, it will not save the default or defined logins details. It will not even retrieve logins created and saved with root access. I could live with that.

    I did some research and dialout:x:20:my-username is already in the group file and no number of reboots gives puTTY the access to the root-saved data.

    How can I launch puTTY via Unity and allow it to save stuff, or at least read the root config files?

    Thanks

    • LinuxFerLife
      LinuxFerLife about 6 years
      OK, brute forced it. As root, I went to ~/.putty and changed all permissions to my user-name. Now at least it loads the root-saved configs.
    • steeldriver
      steeldriver about 6 years
    • vidarlo
      vidarlo about 6 years
      Why not use ssh user@host in a terminal? That's better integrated than putty on Linux imho.
  • LinuxFerLife
    LinuxFerLife about 6 years
    Dear me, jump to conclusion time eh? :) I used "sudo" only after it failed to save the data the very first time I ran the GUI (via Unity) and I was not, to my knowledge, logged in as su at that time. But, as I mentioned in my comment above, I have brute forced it all back to my ownership.
  • Byte Commander
    Byte Commander about 6 years
    Well, apparently something messed up the ownership of your .putty folder, so either it was putty itself while running as root within your environment, or you screwed something up manually. Folder's don't just switch owners on their own. But whatever the reason was, this is the fix and how to avoid the problem again in the future.