Hyprland
Hyprland copied to clipboard
/tmp/hypr is only accessible by one user
So I have two user on my system, let's say user1 and user2. I usually run Hyprland with user1, and recently I wanted to experiment with Hyprland with user2, which I use for gaming. I logged in into Hyprland as user2 and run hyprctl clients or whatever, and receives this error
Couldn't connect to /tmp/hypr/_1662993714/.socket.sock. (3)
Basically, the socket file didn't exist. Or rather, the directory that's supposed to contain the socket file didn't exist. no socket, no log file, nothing.
$ ls /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE
ls: cannot access '/tmp/hypr/_1662993714/.socket.sock': No such file or directory
The symptom is similar to #642 , but most likely it was from another cause so I'm opening a new issue.
After investigating for a bit, I found out that /tmp/hypr is owned by user1, and user2 could not write into the folder, thus explaining why the socket in user2's session didn't exist.
Apparently Hyprland creates /tmp/hypr directory on behalf of user1 (which is the first to run Hyprland and own /tmp/hypr) and just assume that everyone can write to tmp/hypr`.
I can think of several solutions:
- Append user identifier to
/tmp/hyprdirectory name, such as/tmp/hypr-user1or something. This way each user have their own directory that they can write into. One caveat is this will break compatibility with practically every script that connect to Hyprland socket. - Make
/tmp/hyprwritable by everyone. I don't think this is the best solution, security wise.
It would be nice to move it to $XDG_RUNTIME_DIR instead
no, because /tmp lives in the ram and is therefore much faster.
$ findmnt $XDG_RUNTIME_DIR
TARGET SOURCE FSTYPE OPTIONS
/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,size=3269616k,nr_inodes=817404,mode=700,uid=1000,gid=100
oh that changes things. At any rate, the issue of backwards compat is still there.
Regarding backwards compatibility, I think a check can be performed on ownership of /tmp/hypr and if the current user owns it, create /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE as symlink to the new location. Of course this is a temporary measure, and eventually /tmp/hypr should be deprecated.
the problem with moving to /run/user/1000 is that you cannot symlink /tmp <-> /run/user/
this issue should be solved in 96cb47fc64438c93e7663afa832a567120f82128
/tmp/hypr is now 777 and individual directories are 770
Ran into the same issue apparently. Had hyprland installed for a while, but only now tried to start it on a new user.
Version 0.21.0 (from AUR)
Tried to start it with a wrapper script, hyprland tried to create directory in /tmp/hypr and crashed with Permission denied.
Had to do sudo chmod 777 /tmp/hypr - after that everything worked fine.
it should do that on its own, and it does for me:

make sure you don't manually create the directory.