May the source be with you,
but remember the KISS principle ;-)
Key Softpanorama Topics
|About||Contents||Top Updates||Top Visited|
|Bulletin||Selected Papers||Softpanorama Bookshelf||History|
Restricted shells allow you to control the user's environment. The restricted shell, rsh, allows the user to do everything allowed by sh, except:
The restricted shell is /usr/lib/rsh. This should not be confused with the remote shell, which is /usr/bin/rsh.
Don't rely too heavily on the restricted shell. It's not that restricted. While you can't specify a command name that begins with "/", you can specify arguments that do. So if cat is in your path you could type:
% cat /etc/passwd
and have a look at the password file. Also, some programs, such as editors and telnet, allow you to escape out to a shell and editors can edit/view any file with read access allowed on the system.
If Bash is started with the name
rbash, or the `
option is supplied at invocation, the shell becomes restricted. A restricted
shell is used to set up an environment more controlled than the standard
shell. A restricted shell behaves identically to
the exception that the following are disallowed:
SHELLOPTSfrom the shell environment at startup.
&>', and `
>>' redirection operators.
execbuiltin to replace the shell with another command.
-f' and `
-d' options to the
-p' option to the
set +r' or `
set +o restricted'.
How do I break out of a restricted shell?
A restricted shell is a shell that has been modified to allow you to do fewer things than a normal shell would allow you to do. It may allow you to run only certain programs. It may stop you from changing directories. Many sites run their own restricted shells to allow limited use of their systems over the Internet. Restricted shells often make use of the restricted shell (rsh).
On poorly implemented restricted shells you can break out of the restricted environment by running a program that features a shell function. A good example of a shell function is provided by vi. Run vi and use this command:
then shell using this command:
Many menu based restricted shells will allow you to configure your user environment, or to run programs that allow you to configure your user environment. Look for configuration options that refer to executable programs. If the program lets you define an editor, for example, try to set your editor to "/bin/csh -i -f"
If you are not allowed to read files, try to open them inside the e-mail program.
If you are not allowed to edit files, try to save that to file from the e-mail program.
If your restricted shell prevents you from using the "cd" command, try to FTP into your account and change directories. FTP can aso be used to edit files by getting the file, editing it offline, and putting the net file back online.
Like most hacking, trying different things is often the most successful strategy.
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : C++ Humor : ARE YOU A BBS ADDICT? : Object oriented programmers of all nations : C Humor : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor: Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : The Most Comprehensive Collection of Editor-related Humor : Microsoft plans to buy Catholic Church : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor : Best Russian Programmer Humor : Russian Musical Humor : The Perl Purity Test : Politically Incorrect Humor : GPL-related Humor : OFM Humor : IDS Humor : Real Programmers Humor : Scripting Humor : Web Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor :
The Last but not Least
|You can use PayPal to make a contribution, supporting hosting of this site with different providers to distribute and speed up access. Currently there are two functional mirrors: softpanorama.info (the fastest) and softpanorama.net.|
The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: July 07, 2013