file permissions

file permissions

Post by Maurice Samue » Tue, 09 May 2000 04:00:00



how can i make the default for my shell-environment to be such that when i create a new file (ie, touch
<filename>; vi <filename>) it is executable? as far as i can tell, umask doesn't
allow this behavior.
thanks
-maurice

 
 
 

file permissions

Post by Barry Margoli » Tue, 09 May 2000 04:00:00




>how can i make the default for my shell-environment to be such that when
>i create a new file (ie, touch
><filename>; vi <filename>) it is executable? as far as i can tell, umask doesn't
>allow this behavior.

There's no way to do this in standard Unix.  The program that creates the
file decides which permissions to turn on by default, and umask specifies
which of them to turn off.  Programs that are designed to create executable
files (mainly compilers and linkers) and directories include the executable
bits in their default permissions, and just about everything else doesn't.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

file permissions

Post by Maurice Samue » Tue, 09 May 2000 04:00:00


hmm, so does this mean that i would have to come up
with custom functions to get this functionality (i use ksh)?
any suggestions?
thanks
-maurice



: >how can i make the default for my shell-environment to be such that when
: >i create a new file (ie, touch
: ><filename>; vi <filename>) it is executable? as far as i can tell, umask doesn't
: >allow this behavior.

: There's no way to do this in standard Unix.  The program that creates the
: file decides which permissions to turn on by default, and umask specifies
: which of them to turn off.  Programs that are designed to create executable
: files (mainly compilers and linkers) and directories include the executable
: bits in their default permissions, and just about everything else doesn't.

: --

: Genuity, Burlington, MA
: *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
: Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

file permissions

Post by bmar.. » Tue, 09 May 2000 04:00:00



   >how can i make the default for my shell-environment to be such that
   >when i create a new file (ie, touch <filename>; vi <filename>) it
   >is executable? as far as i can tell, umask doesn't allow this
   >behavior. thanks
You can't unless you write your own shell, but you could write an alias or a
function that does "vi $1; chmod +x $1".

Net-Tamer V 1.08X - Test Drive

 
 
 

file permissions

Post by Barry Margoli » Tue, 09 May 2000 04:00:00




>hmm, so does this mean that i would have to come up
>with custom functions to get this functionality (i use ksh)?
>any suggestions?

It's not governed by the shell -- it's through communication between the
application and the kernel.  The best I can suggest is to write a little
shell script called "mytouch":

#!/bin/ksh


Then you can do "mytouch filename" to create executable files; it won't
cause "vi filename" to create executables, but you could create a "myvi"
script that does that.




>: >how can i make the default for my shell-environment to be such that when
>: >i create a new file (ie, touch
>: ><filename>; vi <filename>) it is executable? as far as i can tell,
>umask doesn't
>: >allow this behavior.

>: There's no way to do this in standard Unix.  The program that creates the
>: file decides which permissions to turn on by default, and umask specifies
>: which of them to turn off.  Programs that are designed to create executable
>: files (mainly compilers and linkers) and directories include the executable
>: bits in their default permissions, and just about everything else doesn't.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
 
 
 

file permissions

Post by Chris Matter » Wed, 10 May 2000 04:00:00




>    >how can i make the default for my shell-environment to be such that
>    >when i create a new file (ie, touch <filename>; vi <filename>) it
>    >is executable? as far as i can tell, umask doesn't allow this
>    >behavior. thanks
> You can't unless you write your own shell, but you could write an alias or a
> function that does "vi $1; chmod +x $1".

Rewriting the shell won't do any good because the shell has nothing
to do with it.  This behavior is part of the program's (vi's, touch's,
etc.) code.  To change this behavior, he'd have to patch vi, touch,
and every other program he wants to write executable files.

                               Chris Mattern

 
 
 

file permissions

Post by lmack.. » Wed, 10 May 2000 04:00:00


Sorry have to say this.  Stop being a lazy wench and do it the "old
fasion way"  use chmod (744) (444) <filename> takes two seconds and you
get to practice using a good command.  I like the numbers they add up
better.





> >    >how can i make the default for my shell-environment to be such
that
> >    >when i create a new file (ie, touch <filename>; vi <filename>)
it
> >    >is executable? as far as i can tell, umask doesn't allow this
> >    >behavior. thanks
> > You can't unless you write your own shell, but you could write an
alias or a
> > function that does "vi $1; chmod +x $1".

> Rewriting the shell won't do any good because the shell has nothing
> to do with it.  This behavior is part of the program's (vi's, touch's,
> etc.) code.  To change this behavior, he'd have to patch vi, touch,
> and every other program he wants to write executable files.

>                                Chris Mattern

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

file permissions

Post by Chris F.A. Johns » Wed, 10 May 2000 04:00:00



: how can i make the default for my shell-environment to be such that when i create a new file (ie, touch
: <filename>; vi <filename>) it is executable? as far as i can tell, umask doesn't
: allow this behavior.

I really don't think you would want that as default behaviour.

I use the following shell script to edit shell scripts:

#!/bin/sh
# create and edit a shell script

if [ "$1" ]
then
    if [ ! -s $1 ]
    then
        echo "#!/bin/sh" > $1
    fi
    chmod a+x $1
    ${EDITOR:-emacs} $1
fi

--
        Chris F.A. Johnson

        -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
               Everything in moderation - including moderation  

 
 
 

1. file permissions/permission execution

We are novice CGI users/scripters having problems with permission
executions for use in CGI forms.
The message we have been getting is as follows " FORBIDDEN you don't
have permission to access "......etc." on this server"
How do we remotely perform permission executions from a mac to a UNIX
server.
Than
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).

2. Opinions: Best book on Linux (advanced)

3. Newbie: Unix File Permissions on HTML files?

4. Recursively replace a name in several files

5. Question about file permissions - sharing data files between multiple users

6. socket reads and error returns

7. file permissions & group membership when uploading files via FTP

8. Elapsed-time function

9. mail problem: file permissions for lock file

10. Setting default file permissions on ftp'd files.

11. I get "file permissions deny server execution" on gif files in cgi-bin, why?

12. ftpd, default file permissions on creating a file on Solaris, SunOS 5.5.1

13. default file permissions for ftp'd files