DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD General

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

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 16th April 2023
cabriofahrer cabriofahrer is offline
New User
 
Join Date: Sep 2022
Posts: 8
Unhappy Commands like "ifconfig" do not work in X when using xdm

I do not know much about NetBSD, because I am a FreeBSD user. However I wanted to check out NetBSD because I was curious and here is something that I find very irritating: When logging in as a normal user through xdm (user and xdm have been created / activated with sysinst), when opening a terminal, commands like "ifconfig", shutdown -p now" or "pkgin istall" do not work, simply do not "exist", while when logging in without xdm being started as normal user in the console and then doing "startx", everything works.
So why is that?
Reply With Quote
  #2   (View Single Post)  
Old 16th April 2023
bsd-keith bsd-keith is offline
Real Name: Keith
Open Source Software user
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 348
Default

As far as I'm aware, those are 'system' commands, & therefore need 'root' permissions to run.
I think you would need to be in the 'wheel' group, & use 'su' before you can issue them.
__________________
Linux since 1999, & also a BSD user.
Reply With Quote
  #3   (View Single Post)  
Old 16th April 2023
cabriofahrer cabriofahrer is offline
New User
 
Join Date: Sep 2022
Posts: 8
Default

No, that is not the point. "ifconfig" does not need root permissions. And if you type a command that needs root permissions without "su", you will get a "Permission denied" message. But even when typing "su" (I am in the wheel group) and I get a # prompt, thhe commands do not work. When logging into account through xdm, they siply do not exist in the path.
Reply With Quote
  #4   (View Single Post)  
Old 16th April 2023
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,508
Default

I've noticed that some shell's have minimal defaults including exported paths:

A quick search confirms this possibility:
https://www.reddit.com/r/NetBSD/comm..._use_ifconfig/

You can quickly test with
Code:
# /sbin/ifconfig
Reply With Quote
  #5   (View Single Post)  
Old 17th April 2023
cabriofahrer cabriofahrer is offline
New User
 
Join Date: Sep 2022
Posts: 8
Default

Great, thanks! So this works:

"it's likely that /sbin is not in your shell's PATH. Try export PATH=/sbin:$PATH"

After doing the export, "ifconfig" works. So I think this is my problem:

"It's also possible if you created a user account with useradd without initializing the home directory from the skeleton files with -m".

As I said, I created the user with sysinst, which I guess invokes useradd. So the question now is: How can I "initialize the home directory from the skeleton files with -m"?
Reply With Quote
  #6   (View Single Post)  
Old 18th April 2023
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,508
Default

I'm not sure if the useradd -m flag would overwrite your existing /home directory. I think usermod(8) is what I'd try first.

What shell, of 3 possibilities (sh/csh/ksh), are you using?
The handbook indicates that ~/.profile will export the paths to all three shells. You could also copy the system configuration file for the particular shell you are using and then add the command to export the path for that particular shell.
https://docstore.mik.ua/orelly/unix3/upt/ch03_03.htm
http://www.netbsd.org/docs/misc/inde...adding-to-path

Last edited by shep; 18th April 2023 at 01:01 AM.
Reply With Quote
  #7   (View Single Post)  
Old 18th April 2023
cabriofahrer cabriofahrer is offline
New User
 
Join Date: Sep 2022
Posts: 8
Default

Quote:
Originally Posted by shep View Post
What shell, of 3 possibilities (sh/csh/ksh), are you using?
I use sh. But it has something to do with using xdm or not. When I log in as a normal user in the console and then do a "startx", everything works.
I also tried something else: I installed slim and fluxbox and created an .xinitrc file containing only "/usr/pkg/bin/startfluxbox". So when starting slim and then logging in, fluxbox starts. In fluxbox then all commands work in xterm.
So I guess there is nothing wrong with my user account or my .profile.
It looks like xdm is somehow ignoring my .profile?
Reply With Quote
  #8   (View Single Post)  
Old 19th April 2023
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,134
Default

Do you have this in .Xdefaults?:
Code:
XTerm*loginShell:true
This setting forces xterm to read .profile and this is what usually sets the PATH.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #9   (View Single Post)  
Old 21st April 2023
cabriofahrer cabriofahrer is offline
New User
 
Join Date: Sep 2022
Posts: 8
Default

No. I have just created a .Xdefaults file containing that line but it does not make a difference. Meanwhile I have also found this thread here:

https://www.reddit.com/r/NetBSD/comm..._any_other_os/

But I do not quite understand what the answers are saying: That xdm does not "source" the .profile file and why should it do that anyway? Can someone please explain in more detail?
Reply With Quote
Old 22nd April 2023
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,508
Default

I recall that the NetBSD /etc/X11/xinit/xinitrc file references ~/.Xresources instead of ~/.Xdefaults.

My understanding is that ~/.Xdefaults can be ignored under certain circumstances.

https://superuser.com/questions/2439...-and-xdefaults

In my occasional forays into NetBSD, when using xdm, I have copied /etc/X11/xinit/xinitrc to ~/.Xresouces, edited it to start my window manager. You can also force the implementation of your ~/.Xresources or ~/.Xdefaults by running xrdb on the configuration file:
Code:
 $ xrdb ~/.Xresouces
.
Reply With Quote
Old 13th November 2023
rufwoof rufwoof is offline
Port Guard
 
Join Date: Nov 2023
Posts: 25
Default

Quote:
Originally Posted by cabriofahrer View Post
I do not know much about NetBSD, because I am a FreeBSD user. However I wanted to check out NetBSD because I was curious and here is something that I find very irritating: When logging in as a normal user through xdm (user and xdm have been created / activated with sysinst), when opening a terminal, commands like "ifconfig", shutdown -p now" or "pkgin istall" do not work, simply do not "exist", while when logging in without xdm being started as normal user in the console and then doing "startx", everything works.
So why is that?
As 'user' su into root using
su -
instead of just su

You might also like to change to using ksh instead of just sh
chsh user
(for root you can run just chsh)
and edit the shell to ksh, that way you'll have tab completion and up arrow history
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
Difference between"arp info overwritten" and " duplicate IP address " varag OpenBSD Security 1 6th April 2015 02:57 PM
How to replace "ectags" with "ctags"? fender0107401 OpenBSD Packages and Ports 5 16th April 2013 10:01 AM
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" jb_daefo Guides 0 5th October 2009 09:31 PM
"Thanks" and "Edit Tags". diw Feedback and Suggestions 2 29th March 2009 12:06 AM
New Kernel: "make depend" doesn't work nihonto NetBSD General 9 23rd January 2009 09:02 PM


All times are GMT. The time now is 05:35 PM.


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