Open apoorv569 opened 1 year ago
What makes you think that the autostart file starts programs as the root
user?
What makes you think that the autostart file starts programs as the
root
user?
Because I had problems with 2 programs reading wrong configuration file mpd
and syncthing
. If I run any of these from terminal without specifying path to configuration file they read the correct config file i.e under ~/.config
but if I put these in autostart
file they use the config form /etc/
or whichever the default is.
Also if I try to kill
the process I could not, without using sudo
.
I also noticed the SHCMD
in the config.h
for dwm
runs the command as root user as well. I have couple of keybinds like this,
{ MODKEY, XK_x, spawn, SHCMD("~/.local/bin/scripts/dm-scripts/dm-session")},
the dmenu
prompts does open but shows empty. So I am as a workaround point the keybind to another script which runs this script as my user
.
I don't know, it sounds like you are running dwm as the root user.
I don't know, it sounds like you are running dwm as the root user.
How do you mean? I login as my user from my login manager (lightdm
). This keybind used to work fine when I was using my own fork
of dwm
.
To answer your question the autostart.sh should not run as the root user, it would not be normal.
The autostart file and when spawning commands from dwm should run as the user that is logged in.
ps -ef
will tell you if the program is running as your user or not.
As for your symptoms:
A program may not necessarily adhere to a kill
even if it is running as your user, but a kill -9
should usually work.
If you find that you can open a terminal and start a program (or script) fine, but that same program behaves differently when starting via .xinitrc, autostart.sh or when spawning via dwm then it may be that the program depends on some environment variables that are not set in the current session.
ps -ef
will tell you if the program is running as your user or not.
ps -ef
says programs are running as the correct user..
As for your symptoms:
A program may not necessarily adhere to a
kill
even if it is running as your user, but akill -9
should usually work.If you find that you can open a terminal and start a program (or script) fine, but that same program behaves differently when starting via .xinitrc, autostart.sh or when spawning via dwm then it may be that the program depends on some environment variables that are not set in the current session.
I always use pkill -9
to kill processes.
About the env vars, I have set all my env vars related to programs I use correctly. I have even set the XDG dirs, cache, config and all.
I do use zsh
could that be a issue?
Where do you set those environment variables?
If you run this then that may give you some insight into what environment variables are set for your session (although it is not particularly readable). This will usually be less than what you get when you run env
in a terminal.
cat /proc/$(pidof dwm)/environ
What is being set may depend on the login / display manager. It may be that /etc/environment
is being read, not sure.
The autostart file under
~/.dwm/autostart.sh
starts programs asroot
user which causes issues, sometimes the program reads wrong configuration file sometimes there are permission issues.Is this normal behavior? Can I change this behavior?