FreeBSD-11, Mate, Terminal, Gvim

Manish Jain bourne.identity at hotmail.com
Tue Jul 25 20:36:58 UTC 2017


> That is correct. Like "su -m", "xhost" is to be executed from
> the (non-root) user that controls the display. But when you're
> using the "su -m" approach, it usually isn't even needed.


I tried this from my normal user shell (zsh)

su - -m root -c 'echo $SHELL'

That is not the right shell for root, which on my box uses bash.

All the env variables : USER HOME SHELL are values for the normal user, 
not the root user. But the mess is a bit deeper - even though I am using 
the environment of the normal user (despite the leading - to su), I seem 
to have root privileges. When I run

su - -m root -c gvim

I can actually edit the files that only root has write permission for.

So largely, the su -m approach lets gvim work with root privelelges, 
although the environment seems to be all wrong.

1) Is there some way I can actually do all the above from the root user 
account, using the normal user's existing X server ? I think that 
happens under Linux, so in theory it should be possible under FreeBSD 
too (even if merely as a hack).

2) gvim on my box has been compiled with GTK3+ support. GTK support 
enables specifying a --socketid. I wonder what is that and how to get 
the socket id of an existing GVIM session. Plus, could using socketid 
solve the issue of running gvim from the root account directly ?

Thanks for replying.
Manish Jain


More information about the freebsd-questions mailing list