|
Home > Archive > Unix Programming > February 2007 > Create permissions
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Create permissions
|
|
| fazlin 2007-01-06, 8:01 pm |
| Hi all,
This may be a silly question but plz help me out on this.
I have a directory that is group writable and if i create/copy a file
in the directory, it has the following permissions:
-rw-r--r-- 1 fazlin ukp 0 Jan 4 13:10 test
The issue is that whenever i create/copy files in that directory it has
to be group writable.
Plz lemme know the possible solutions.
Thanks,
Fazlin
| |
| Pascal Bourguignon 2007-01-06, 8:01 pm |
| "fazlin" <fazlincse@gmail.com> writes:
> Hi all,
>
> This may be a silly question but plz help me out on this.
>
> I have a directory that is group writable and if i create/copy a file
> in the directory, it has the following permissions:
>
> -rw-r--r-- 1 fazlin ukp 0 Jan 4 13:10 test
>
> The issue is that whenever i create/copy files in that directory it has
> to be group writable.
>
> Plz lemme know the possible solutions.
The users must set their umask to 002 to have the files created with 664.
With a directory that is group writeable, the users of the group can
still rename and delete that file. So you may change your application
to do that, instead of trying to append or overwrite the files (at
least when it hasn't write access right on the file).
Or, you could have a daemon that watches for bad access rights in the
directory, and set them right.
A worst case alternative is to make the program suid. (the program
that needs to update or overwrite these files, if this is a specific
program).
Also, instead of letting users do random things in this directory,
restrict its access rights and provide a specific tool to access it
(to copy or update files in it). You can set the directory 700 and
use a specific owner, and the tool can be owned by the same specific
owner and suid. So normal users cannot access the contents of the
directory, and the tool can set the access rights as it wants.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"This statement is false." In Lisp: (defun Q () (eq nil (Q)))
| |
| Bo Yang 2007-01-06, 8:01 pm |
| fazlin :
> Hi all,
>
> This may be a silly question but plz help me out on this.
>
> I have a directory that is group writable and if i create/copy a file
> in the directory, it has the following permissions:
>
> -rw-r--r-- 1 fazlin ukp 0 Jan 4 13:10 test
>
> The issue is that whenever i create/copy files in that directory it has
> to be group writable.
>
> Plz lemme know the possible solutions.
>
> Thanks,
> Fazlin
>
I think there must a group sticky bit set in your directory!
run the following commands and paste your result here:
ls -ld your directory
| |
| Pascal Bourguignon 2007-01-06, 8:01 pm |
| Bo Yang <struggle@mail.nankai.edu.cn> writes:
> fazlin :
> I think there must a group sticky bit set in your directory!
> run the following commands and paste your result here:
> ls -ld your directory
This is good to keep the created files inside the same group. But it
won't matter when you move files there, or for the access rights.
[pjb@thalassa tmp]$ ls -la example/
total 108
drwxr-sr-x 2 pjb users 4096 Jan 4 12:35 ./
drwxrwxrwt 33 root root 102400 Jan 4 12:36 ../
[pjb@thalassa tmp]$ touch example/abc
[pjb@thalassa tmp]$ ls -la example/
total 108
drwxr-sr-x 2 pjb users 4096 Jan 4 12:36 ./
drwxrwxrwt 33 root root 102400 Jan 4 12:36 ../
-rw-r--r-- 1 pjb users 0 Jan 4 12:36 abc
[pjb@thalassa tmp]$ touch def
[pjb@thalassa tmp]$ mv def example/
[pjb@thalassa tmp]$ ls -la example/
total 108
drwxr-sr-x 2 pjb users 4096 Jan 4 12:37 ./
drwxrwxrwt 33 root root 102400 Jan 4 12:37 ../
-rw-r--r-- 1 pjb users 0 Jan 4 12:36 abc
-rw-r--r-- 1 pjb pjb 0 Jan 4 12:37 def
--
__Pascal Bourguignon__ http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink.
| |
| Daniel Molina Wegener 2007-02-13, 7:23 am |
| fazlin wrote:
> Hi all,
Hello...
>
> This may be a silly question but plz help me out on this.
Not at all...
> I have a directory that is group writable and if i create/copy a file
> in the directory, it has the following permissions:
>
> -rw-r--r-- 1 fazlin ukp 0 Jan 4 13:10 test
>
> The issue is that whenever i create/copy files in that directory it has
> to be group writable.
>
> Plz lemme know the possible solutions.
Ok, try reading the following man pages for C interfaces:
umask(2), chmod(2), fchmod(2), chown(2)
And the following man pages for the command line utilities:
umask, chmod, chown
>
> Thanks,
> Fazlin
Regards,
--
.O. | Daniel Molina Wegener | C/C++ Developer
..O | dmw [at] unete [dot] cl | FOSS Coding Adict
OOO | BSD & Linux User | Standards Rocks!
|
|
|
|
|