Operating System - HP-UX
1831703 Members
2565 Online
110029 Solutions
New Discussion

VI -- with no shell escape

 
SOLVED
Go to solution
Bhaskar Luitel
Advisor

VI -- with no shell escape


I have been looking for a modified version of VI which does not allow a shell escape. Has anyone come across any such shareware ?
The idea behind this is to let a set of users run VI ( as root) using SUDO.

Thanks In Advance,

Bhaskar

8 REPLIES 8
Bill McNAMARA_1
Honored Contributor

Re: VI -- with no shell escape

sorry not a direct answer, but why do you want to do this? There may be a way to give privilages another way... have a look at SCM
for example. Vi in versions such as elvis
are open source. You can also get script based
editors source on much of the linux on a floppy sites.

Have a look on freshmeat.net or the hpux
porting archive for alternative editors.
http://hpux.connect.org.uk/hppd/hpux/Editors/alpha.html
It works for me (tm)
Thierry Poels_1
Honored Contributor

Re: VI -- with no shell escape

hmmmz, tricky business,

you could set the SHELL parameter to /bin/false before entering vi, but I don't guarantee that this trick is "fool"proof.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Stefan Schulz
Honored Contributor

Re: VI -- with no shell escape

Have you tried to set the vi as your login shell? This should eliminate the shell you could escape to.
No Mouse found. System halted. Press Mousebutton to continue.
Bhaskar Luitel
Advisor

Re: VI -- with no shell escape

Thierry, Is there any way e,g, .exrc or passing some argument that can somehow dictat VI abt the shell escape ( or change its shell from default to to /usr/bin/false).How do we define SHELL to vi ?

Stephan , How can we pass on a file name to the vi when used in shell -- I am getting bus error while trying to do so ( even while using vi in a script -- which in turn defined as the login shell). The Idea is to give access only to the selected files as root. So passing on the filename is important too.

I am still hoping we can get this work thru the standard vi, if not I will take Bill's suggestion.

Thanks you all for your kind replies..
-Bhaskar
Thierry Poels_1
Honored Contributor

Re: VI -- with no shell escape

if in a script:
SHELL=/bin/false
vi $myfile

from the command line:
you could create an alias for vi:
alias vi="SHELL=/bin/false; /usr/bin/vi"
but this leaves the SHELL parameter set to /bin/false
and secondly if they have access to the command line; what's the use of denying shell access from within vi?

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Steven Sim Kok Leong
Honored Contributor
Solution

Re: VI -- with no shell escape

Hi,

If you are looking for a modified version of vi which does not allow a shell escape, then you should be using rvim.

rvim is alike the vim/vi, but with restrictions. It will not be possible to start shell commands, or suspend vim.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com

Bill McNAMARA_1
Honored Contributor

Re: VI -- with no shell escape

Sounds like Steve found your alternative and
luckily enough it's already ported:

http://hpux.connect.org.uk/hppd/hpux/Editors/vim-5.7/

Later,
Bill
It works for me (tm)
Bhaskar Luitel
Advisor

Re: VI -- with no shell escape

Thanks Steve , Bill and Theiry for your responses. 'rvim'works great for my purpose.
thanks again