LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


View Poll Results: What is your preferred Linux login shell?
ash 0 0%
bash 287 81.77%
csh 4 1.14%
dash 3 0.85%
es 0 0%
fish 2 0.57%
ksh 18 5.13%
pdksh 2 0.57%
rc 1 0.28%
scsh 0 0%
sh 3 0.85%
tcsh 10 2.85%
wish 0 0%
zsh 16 4.56%
Other 5 1.42%
Voters: 351. You may not vote on this poll

Reply
  Search this Thread
Old 07-16-2014, 10:05 AM   #106
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886

Quote:
Originally Posted by champted View Post
I will leave bash on the production systems at work, though, as I'm not the only one who uses them.
You can happily have more than one shell installed and decide on a per-user basis which one to use.


Quote:
________________________

Slackware 14.0 (CLI), Linux Mint 13 MATE, Windows 7, Windows XP, and Windows 2000 at work
Kubuntu 12.04.4 and Windows 7 dual-booting on the laptop
MEPIS 11.0 on the home desktop (soon to become Linux Mint 17 KDE) dual-booting with Windows 7
PiBang v.20131119 (CLI) on the Raspberry Pi old model B (256 MB RAM)
A better place for this would be your signature.
 
1 members found this post helpful.
Old 07-16-2014, 12:09 PM   #107
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by Myk267 View Post
ksh seems like the unholy child of shell and a general purpose programming language.
All shell programs are Command and Programming Languages -- from sh to ksh to base, that's what they are: you execute commands and you can write useful programs in the shell. That would also include derivatives of C-Shell (which is NOT the same thing as Bourne, Korn or BASH, it came out of Berkeley and is distinctive by its convoluted grammar and syntax).

BASH (Bourne Again Shell) is a combination of sh and ksh (the functionality, not the underlying code) with some "extensions" and "features" thrown in. Generally, BASH will run sh and ksh code without too much arguing -- not everything, but pretty much. The grammar and syntax of BASH and KornShell are close enough that you program in the one and run in the other if you're not using BASH extensions (which neither Bourne or KornShell have).

As to user shell preference, it is quite simple to change the 7th field of the user entry in /etc/passwd (optional user command interpreter). This can be done by direct edit of the file (as root) or with usermod -s /bin/shell_name USERNAME (also as root).

A typical user account line looks like this:
Code:
trona:x:1000:100:,,,:/home/trona:/bin/ksh
In the example the optional user command interpreter is KornShell. That could be changed to BASH with
Code:
usermod -s /bin/bash USERNAME
It could also be changed to lock out any log in with
Code:
usermod -s /bin/false USERNAME
You may have noticed if you've looked at /etc/passwd that all of the administrative accounts (except root listed are /bin/false; i.e., you cannot log in to those accounts (attempts will result in immediate exit).

So, anyway, shells are pretty much command interpreters that let you execute commands and write useful programs.

Hope this helps some.

Last edited by tronayne; 07-17-2014 at 12:31 PM. Reason: Removed erroronous info regarding logging in to a /bin/false account
 
1 members found this post helpful.
Old 07-16-2014, 04:26 PM   #108
champted
LQ Newbie
 
Registered: Jun 2014
Location: Northern New York State
Posts: 12

Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
You can happily have more than one shell installed and decide on a per-user basis which one to use.

...

A better place for this would be your signature.
Two good points, thank you.

If I get to play around enough with zsh on the RasPi to become proficient, I'll change my login shell on the Slackware box per tronayne's information (but not until then <grin>).

Signature enabled, per your suggestion.

Thankx again to both of you.
 
Old 07-17-2014, 02:31 AM   #109
derive
Member
 
Registered: Apr 2014
Distribution: debian
Posts: 42

Rep: Reputation: Disabled
Quote:
Originally Posted by tronayne View Post
You may have noticed if you've looked at /etc/passwd that all of the administrative accounts (except root listed are /bin/false; i.e., you cannot log in to those accounts but you can become that user with su - account_name as root. However, there rarely if ever is any excuse for doing so.
Well, you can't su to a user with /bin/false, or yes, technically you can, but the user's shell starts, and if it's /bin/false, exits immediately ( without reading a single command from the terminal )...
Normally the user's shell should listed in /etc/shells, that is checked by the pam_shells module, but the /bin/false exits right after the invocation so that is not too usuable.

Oh, an by the way, if it's allowed, a user can change hisown shell with the chsh command.

Last edited by derive; 07-17-2014 at 02:43 AM.
 
1 members found this post helpful.
Old 07-17-2014, 12:26 PM   #110
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by derive View Post
Well, you can't su to a user with /bin/false, or yes, technically you can, but the user's shell starts, and if it's /bin/false, exits immediately ( without reading a single command from the terminal )...
Normally the user's shell should listed in /etc/shells, that is checked by the pam_shells module, but the /bin/false exits right after the invocation so that is not too usuable.

Oh, an by the way, if it's allowed, a user can change hisown shell with the chsh command.
Oops! Yes, /bin/false exits immediately, duh. A little confused about admin accounts where there is a shell specified (when I've been naughty and done such a silly thing).

About PAM. PAM is not installed by default on Slackware systems -- it's available if needed at Slackbuilds.org but its use is discouraged unless absolutely, positively you must have it for something or other..

Thanks for the reminder.
 
Old 07-18-2014, 01:00 AM   #111
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by tronayne View Post
About PAM. ... its use is discouraged unless absolutely, positively you must have it for something or other.
Do you know the reason for this attitude?
 
Old 07-18-2014, 06:30 AM   #112
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
A lot of reasons, actually. There is a current thread about PAM and Slackware you may find interesting, a particular post being http://www.linuxquestions.org/questi...ml#post5205085 although the entire thread may be of interest.

Hope this helps some.
 
Old 07-18-2014, 06:48 AM   #113
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Ah, okay, thank you. I was just wondering, since SuSE uses PAM since -- oh, probably the glaciers were still around or so .
 
Old 07-27-2014, 08:14 PM   #114
drlasterjr
LQ Newbie
 
Registered: Apr 2006
Location: West Long Branch, NJ
Distribution: Slackware
Posts: 11

Rep: Reputation: 0
Make sure the backslash character is the LAST character ...

Quote:
Originally Posted by Gullible Jones View Post
No. I may come back to this later, but right now I'd rather have a shell that just worked.

Edit: actually this is more interesting than I thought; I thought it was undocumented shell option behavior, but it did not go away when I reset the shell options to defaults. Scary. I had better look into it.

Thanks.
Make sure the blackslash character is the last character on the line before the <lf>. It is an escape character.

This line "this is a single line \A" will output the line "this is a single line A".

This "some shell command line \ <lf>" will result in the space character after the backslash being kept and the newline will be treated as the end of the line. The line output would be "some shell command line <lf>".

For the line to be continued you need to ensure it is "text of the line \<newline>". And if the shell script line ends with "\<cr><lf>" it might cause a problem as well.

Any time I run into this problem I immediately check for trailing space characters and I inevitable find one or more.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Preferred central login server? szboardstretcher Linux - Server 0 03-20-2014 07:45 PM
Which Is Your Preferred Linux Shell? jeremy Linux - General 47 01-10-2014 07:55 PM
Login Shell / Non-Login shell Clarification needed (RHEL 6.3) kingston Linux - Newbie 1 12-07-2012 12:51 AM
Preferred distribution for c and shell programming? Its All in your Head Linux - Distributions 3 07-07-2007 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration