DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 20th June 2019
therue therue is offline
Port Guard
 
Join Date: Feb 2018
Posts: 21
Default Question regarding .xsession, .profile, .kshrc

so, when using xenodm, it bypasses the console so .profile and .xinitrc won't be triggered? and instead what we normally put into those two should be placed in .xsession instead? (and to make sure URxvt*loginShell: true is set in .Xdefaults since I'm using urxvt instead of xterm)

example of my .xsession:
export ENV=$HOME/.kshrc
export LC_CTYPE="en_US.UTF-8"
urxvtd -q -o -f
~/.fehbg &
redshift &
exec cwm

Quote:
if logging in via xenodm(1), add export LC_CTYPE="en_US.UTF-8" to your ~/.xsession before starting the window manager. See customizing X for more details.
If logging in via the text console, add export LC_CTYPE="en_US.UTF-8" to your ~/.profile. The text console's UTF-8 support is a work in progress, and some non-ASCII characters may not display properly.


QUESTION: when i did it this way, it did work, urxvt worked, and the utf-8 was set as well, and .kshrc with my custom aliases worked too... but does that basically mean that if i use xenodsm, i should just have all the stuff i normally would put into .profile in .xsessions as well?!?

for example, the default .profile contains: PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:. export PATH HOME TERM

does that mean i should put this into my .xsessions too? when using xenodm is .profile not used at all then? yet PATH HOME TERM from .profile did somehow get through though when i echo $PATH, echo $HOME, echo $TERM?

if it's not too much trouble could someone help a noob understand how to properly these up for openbsd? (.xsession, .profile, .kshrc)

ALSO, i noticed that when I 'ps -A' to check the processes, there appears to be two instances of urxvtd? why is that? shouldn't there be only 1 urxvtd, and the rest of the terminals as -ksh (since urxvtd is the daemon which i started from .xsession, and urxvtc as the client each time i open a new terminal - which each appear as an instance of -ksh) ?
Reply With Quote
  #2   (View Single Post)  
Old 20th June 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,819
Default

It appears this is the best answer:

https://www.reddit.com/r/openbsd/com...ssion/ern5dn3/
Reply With Quote
  #3   (View Single Post)  
Old 20th June 2019
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bloaty McBloatFace
 
Join Date: Dec 2015
Location: London
Posts: 146
Default

Quote:
Originally Posted by therue View Post
so, when using xenodm, it bypasses the console so .profile and .xinitrc won't be triggered?
Yes.

Quote:
Originally Posted by therue View Post
and instead what we normally put into those two should be placed in .xsession instead?
Yes.

Quote:
Originally Posted by therue View Post
(and to make sure URxvt*loginShell: true is set in .Xdefaults since I'm using urxvt instead of xterm)
I don't think so, ~/.Xdefaults isn't read unless you run xterm or urxvt and by the time you can do that then login has already happened.

But maybe I have misunderstood you here.

Quote:
Originally Posted by therue View Post
but does that basically mean that if i use xenodsm, i should just have all the stuff i normally would put into .profile in .xsessions as well?!?

for example, the default .profile contains: PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:. export PATH HOME TERM

does that mean i should put this into my .xsessions too?
You only need to put custom content into ~/.xsession, PATH and a few other variables are set automatically:

https://man.openbsd.org/xenodm#SESSION_PROGRAM

Quote:
Originally Posted by therue View Post
i noticed that when I 'ps -A' to check the processes, there appears to be two instances of urxvtd? why is that?
Urxvt is setgid and forks itself when run.

From urxvt(7):
Quote:
I need to make it setuid/setgid to support utmp/ptys on my OS, is this safe?

It should be, starting with release 7.1. You are encouraged to properly install urxvt with
privileges necessary for your OS now.

When rxvt-unicode detects that it runs setuid or setgid, it will fork into a helper process
for privileged operations (pty handling on some systems, utmp/wtmp/lastlog handling on
others) and drop privileges immediately. This is much safer than most other terminals that
keep privileges while running (but is more relevant to urxvt, as it contains things as perl
interpreters, which might be "helpful" to attackers).

This forking is done as the very first within main(), which is very early and reduces
possible bugs to initialisation code run before main(), or things like the dynamic loader of
your system, which should result in very little risk.
To prevent this from happening use
Code:
# chmod g-s $(which urxvtd)
You should then only see one urxvtd process.

But you should probably use xterm instead, it has been audited by the OpenBSD devs (and it supports truecolour, unlike urxvt).
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesnot OpenBSD run /etc/profile and ~/.profile ? sw2wolf OpenBSD General 2 28th August 2012 11:26 PM
when and by what is .profile read? kasse FreeBSD General 8 11th September 2008 08:46 AM
working with .profile and history uptonm OpenBSD Security 1 15th August 2008 12:14 PM


All times are GMT. The time now is 06:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick