LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-14-2002, 04:42 PM   #16
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58

try echo testing > ~/test

look for a file in their home folder named test


you are using bash right
 
Old 12-14-2002, 08:48 PM   #17
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
Actually for rbash all you have to do is sym-link bash to rbash and it works. and add it to /etc/shells

And if i remember right, you need to use ssh or some other non-interactive login for the .bashrc file to get parsed. Have you tested it with SSH or just through login?
 
Old 12-15-2002, 12:44 AM   #18
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Original Poster
Rep: Reputation: 30
yes, im using bash.

i changed the .bashrc file to "echo testing > test" but there isn't any test file there...

turnip, i don't have rbash at all...and theres no compiling programs installed as its a firewall distro...

and yes, this is all thru SSH, theres no monitor on this machine...
 
Old 12-15-2002, 01:02 AM   #19
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
ok,

loging in with ssh will cause the system to run files in /etc/profile.d/

so you can add commands to a file.sh and maybe file.csh depending on your shell



cat bsd-games.sh
#!/bin/sh
# Print a fortune cookie for login shells:

echo
fortune fortunes fortunes2 linuxcookie
echo

Last edited by DavidPhillips; 12-15-2002 at 01:04 AM.
 
Old 12-15-2002, 01:43 AM   #20
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Original Poster
Rep: Reputation: 30
but if i put a file in /etc/profile.d called restrict.sh with:
Code:
/bin/bash -r
then won't EVERY user that logs in be restricted (which is exactly what i want...apart from a few users like admin, root...etc) seeings as everybody are running all those scripts?
 
Old 12-15-2002, 03:11 AM   #21
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
didn't know that's what you were doing, I thought you wanted to print a message


but it does seem that if you run a script from there that points to a login script in their home folder you should be able to do it





~/login.sh

Last edited by DavidPhillips; 12-15-2002 at 03:13 AM.
 
Old 12-15-2002, 03:43 AM   #22
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Original Poster
Rep: Reputation: 30
ok...i created a run.sh in /etc/profile.d which contains ~/.bashrc and i chmodded .bashrc to +x...

now when i login i get this error:
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: Error 23
and whenever i issue ANY command, it gives me that error...


now ive found one problem with /bin/bash -r....when they type exit, it quits and returns to a normal shell...

maybe this isn't the way to go....anybody know where i can grab one of those other shells from? that don't need to be compiled..

Last edited by Grim Reaper; 12-15-2002 at 03:44 AM.
 
Old 12-15-2002, 07:39 AM   #23
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
Not sure why you would execute .bashrc

wouldn't you want to run a login script

I would think that you could put the script in the users home that get chrooted

the other users would not have the script


it could be something like this

if [ -f ~/somefile ]; then

somechrootscript

fi

or [ -x ~/script ]

Last edited by DavidPhillips; 12-15-2002 at 07:42 AM.
 
Old 12-15-2002, 11:24 AM   #24
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
To make rbash work all you need to do is this

ln -s /bin/bash /bin/rbash or make a copy of bash and rename it rbash

You dont need to build it, its apart of the base package.
Once you do that and add it to /etc/shells they will not be able to change shells or anything.

However, if they use vi, then they can get out by

:set shell /bin/sh
:shell

rbash will chroot the user to things like ls and cp mv and what not need to be copied to their home dir.

Last edited by turnip; 12-15-2002 at 12:54 PM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh command logging jcookeman Linux - Security 3 08-26-2008 02:50 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM
SSH - Logging out r4merlin Linux - Networking 1 11-02-2003 12:50 PM
SSH problems logging in ra_adi Linux - Networking 3 10-22-2003 12:55 PM
logging onto SSH robmainella Linux - Newbie 5 08-26-2003 02:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:52 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