SUMMARY: vi-questions (permissions and tabulators)

From: bernhard_fank@ukl.uni-heidelberg.de
Date: Thu Mar 19 1998 - 08:56:50 CST


Thank to everyone who answered. Full mailing-list at the end.

My original question:

> Hi sun-managers,
> 1. how do I get vi to use other tabulators all the time? I want alter
> the tabulators and vi shall use it during all future sessions.
>
> 2. I have a file with rws-permissions set by the user. After editing
> it with vi they are set to rwx. How can I get vi to let the permission
> rws? (I know this shouldn't be done for skript-files.)
>
> I would be very pleased, if you could help me.
>
> Bernhard Fank

Point 1
Answer from Mariel Feder (see also answer from Casper):
You can set different permanent options for vi for a certain user,creating a
file $HOME/.exrc
There you can specify the tab size, adding the line:
set tabstop=8
There are some more options you can specify there, like
showmode, autoindent, etc.
For a detailed list of options, take a look at man ex.
If you want to use a config file different than $HOME/.exrc
you must create the file wherever you want, and have
the variable EXINIT pointing to it.
Thus, you can specify a generic config file for vi, and have
all the users pointing to it, so manteinance of the file would
be easier, and you can ensure no user includes a mistake
in it.

Point 2
Answer from David Thorburn-Gundlach:
vi isn't the culprit resetting your SUID flag; any time an SUID/SGID
file is modified, the OS resets the SUID/SGID flag. If you want vi to
be smart enough to detect and reset an SUID/SGID flag, you might wrap
it in a shell script which performs the check and resets the proper
bit as necessary.

Thanks to all
Bernhard Fank

--------------------Full List-----------------------------------------------
1.
You can set different permanent options for vi for a certain user,creating a
file $HOME/.exrc
There you can specify the tab size, adding the line:
set tabstop=8
There are some more options you can specify there, like
showmode, autoindent, etc.
For a detailed list of options, take a look at man ex.
If you want to use a config file different than $HOME/.exrc
you must create the file wherever you want, and have
the variable EXINIT pointing to it.
Thus, you can specify a generic config file for vi, and have
all the users pointing to it, so manteinance of the file would
be easier, and you can ensure no user includes a mistake
in it.
 Mariel Feder - I.T. Consultant
 mfeder@meralco.com.ph

 Phone: (63) (2) 632.8862 / 632.8977
 Fax: (63) (2) 632.8868

 Meralco Electric Company
 Distributed Information Technology Team
 Manila - Philippines

-------------------------------------------------------------

1.
A "tab" (^I) is 8 spaces wide; this is a hard coded assumption in all
terminal emulators; you can set the ts to a different value, but that
would make the files unreadable outside vi.

You can use "set sw=2" in your ~/.exrc and then use ^T for tab stops.
2.
You can't. Vi simply overwrites the file; the kernel then
clears the set-uid bit as a protection measure.

Vi doesn't care about file modes.

Casper

casper@holland.Sun.Com

-------------------------------------------------------------

1.
Create a file .exrc in your home directory. Add a line:

set tabstop=4

Then go and find a good vi reference chart or grab one of
the books on vi.

2.
Hmmm, normally I would have said to add the following into your
.exrc file:

map ZS :!chmod o+s %

However, vi running on Solaris tells me that it's too dangerous
to map that. You may wish to try it anyway, but I agree that it
is pretty risky.

        Peter B.

----------
Peter Bestel Email: peterb@uniq.com.au
Technical Consultant Snail: GPO Box 4518, Sydney 2001, Australia
Uniq Professional Services Phone: +61 2 9557 3708 Fax: +61 2 9557 3708
                            WWW : http://www.uniq.com.au/

-------------------------------------------------------------

1.
I'm not sure what you mean by setting tabulators in vi, so I don't
know that I can help you. If you want to set the tab stops to
something other than every 8 columns, check out the ":set tabstop=X"
and ":set hardtabs=X" commands. To make such changes permanent, put
the commands in your .exrc file.
2.
vi isn't the culprit resetting your SUID flag; any time an SUID/SGID
file is modified, the OS resets the SUID/SGID flag. If you want vi to
be smart enough to detect and reset an SUID/SGID flag, you might wrap
it in a shell script which performs the check and resets the proper
bit as necessary.

:-D
--David Thorburn-Gundlach * It's easier to fight for one's principles
(play) david@bae.uga.edu * than to live up to them. -- fortune cookie
(work) david_thorburn-gundlach@groton.pfizer.com Helping out at Pfizer
http://www.bae.uga.edu/other/david/

-----------------------------------------------------------------------
for point 2, it is normal that the files perms are changed if the user that edit
the file is not the owner of the file. That way, it prevent group users to gain
unauthorised "owner" previledges on commands "newly added" to the edited file.

For point 1, I remember that it can be set in an environement varianbles. Maybe
in ~/.exrc , not sure.

Hope this help a bit!

Daniel Beaudry
V.P. Technologies
Communications MULTIMEDIA / Enter-Net Tel : (514) 652-7189
2100, boul. Rene-Gaultier Fax : (514) 652-6973
Varennes (Quebec), J3X 1P1 E-Mail: Daniel.Beaudry@Enter-net.com

-------------------------------------------------------------

1.
shiftwidth or tabstop are clearly documented in the man page.
2.
not possible - any change of mode on a set-uid/set-gid file loses the
bit for security reasons.

                l & h,
                kev

kevin.sheehan@uniq.com.au
-------------------------------------------------------------

1.
I hope I understand you. Are you asking how to change the tabstops in vi?
If so, here is how you do it:

In vi command-mode type: set ts=xx (where xx is the number of tab spaces
you want)

To make this a permenant change, create the file ".exrc" in your home
directory and place the word "ts=xx" at the top. Each time you start vi,
this file will be referenced and will automatically set the value "ts" with
the corresponding value "xx".

Hope this helps!

Ron Kelley
TBM System Engineer
rkelly@infoave.net
-------------------------------------------------------------
1.
To retain settings between vi sessions, use a .exrc file in your home
directory.

dellis@frycomm.com
-------------------------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:34 CDT