Hitchhiker's Guide to Openbsd


- Can I change the root shell?


Download 1.27 Mb.
Pdf ko'rish
bet162/258
Sana04.04.2023
Hajmi1.27 Mb.
#1328980
1   ...   158   159   160   161   162   163   164   165   ...   258
Bog'liq
obsd-faq49

10.17 - Can I change the root shell?
It is sometimes said that one should never change the root shell, though there is no reason not to in 
OpenBSD. 
The default shell for root on OpenBSD is 
ksh

A traditional Unix guideline is to only use statically compiled shells for root, because if your system 
comes up in single user mode, non-root partitions won't be mounted and dynamically linked shells won't 
be able to access libraries located in the 
/usr
partition. This isn't actually a significant issue for 
OpenBSD, as the system will prompt you for a shell when it comes up in single user mode, and the default 
is 
sh
. The three standard shells in OpenBSD (
csh

sh
and 
ksh
) are all statically linked, and thus usable in 
single user mode. 
10.18 - What else can I do with ksh?
http://www.openbsd.org/faq/faq10.html (25 of 32)9/4/2011 10:02:15 AM


10 - System Management
In OpenBSD, 
ksh
 is 
pdksh
, the Public Domain Korn Shell, and is the same binary as 
sh

Users comfortable with bash, often used on Linux systems, will probably find 
ksh
very familiar. Ksh(1) 
provides most of the commonly used features in bash, including tab completion, command line editing and 
history via the arrow keys, and CTRL-A/CTRL-E to jump to beginning/end of the command line. If other 
features of bash are desired, bash itself can be loaded via either 
packages
or 
ports

The command prompt of ksh can easily be changed to something providing more information than the 
default "$ " by setting the 
PS1
variable. For example, inserting the following line: 
export PS1='$PWD $ '
in your 
/etc/profile
produces the following command prompt: 
/home/nick $
See the file 
/etc/ksh.kshrc
, which includes many useful features and examples, and may be invoked 
in your user's 
.profile

OpenBSD's ksh(1) has been enhanced with a number of "special characters" for the primary prompt string, 
PS1, similar to those used in bash. For example: 
\e - 
Insert an ASCII escape character.
\h - 
The hostname, minus domain name.
\H - 
The full hostname, including domain name.
\n - 
Insert a newline character.
\t - 
The current time, in 24-hour HH:MM:SS format.
\u - 
The current user's username.
\w - 
The current working directory. $HOME is abbreviated as `~'.
\W - 
The basename of the current working directory.
\$ - 
Displays "#" for root users, "$" for non-root users. 
(see the 
ksh(1)
man page for more details, and many, many more special characters! Also note the "$" 
character has special meaning inside double quotes, so handle it carefully) 
One could use the following command: 
export PS1="\n\u@\H\n\w \\$ "
to give an overly verbose but somewhat useful prompt. 
http://www.openbsd.org/faq/faq10.html (26 of 32)9/4/2011 10:02:15 AM


10 - System Management

Download 1.27 Mb.

Do'stlaringiz bilan baham:
1   ...   158   159   160   161   162   163   164   165   ...   258




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling