Re: File Permissions problem : Cry for HELP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Me2resh Lists wrote:
> Hi all, i am a web developer and i use fedora core 5, i have a 
> problem with file permissions, each new file i need to create i have
>  to set the permissions for it manually so it can be executed, how
> can i make the default permission for created files 775
> automatically,

Are you serious?
you want *files* that you create to have *execute* access by default?
Sorry, can't be done. The kernel default for permissions is...
on directories: 777 (drwxrwxrwx)
on files: 666 (-rw-rw-rw)
the only thing that changes this is your umask, which withholds certain
permissions. It cannot *add* permissions that would never be set.

as a normal (unprivileged) system user, your umask should be 0002, which
will result in permissions as follows:
dirs: 775
files: 664

> the other thing is after i have all my application working 
> successfully on my localserver, when i upload it to the internet, it
>  gets the wrong permissions and i have to set the permissions for
> each file and folder all over again, imagine how this can be painfull
>  when the application has more than 1000 files

not really. If you *really* want to change 1000 files so that they have
execute perms (and write permissions for group) then you can use a
recursive chmod command:
chmod -R 775 /dir/containing/files
or more appropriately:
chmod -R a+x /dir/  (your files should have group write set anyway. The
default umask does not prevent this)
if it is only a subset of the files and dirs you wish to change, you
could use a 'find'command (optionally piped into xargs) to run one of
those chmod commands on only the files you wish to alter.

When you upload files to the server, they are *newly* created files
there, and will get the default permissions on that end as well.
you could of course wriute a small shell script that runs the chmod
commands you need and run it on those files after the upload. You
clearly have shell access on the remote host (otherwise you wouldn't be
able to manually change permissions after upload).
Do you have ssh access? you could use rsync, which will use ssh for
transport and can preserve permissions and ownership.
scp -p -r /local/dir remote-host:/remote/dir
will do similar things.

Have you considered packaging your web app as an RPM? You can set
default permissions for every file it contains if you do this.
It will also give you pretty decent version control.

Regards

Stuart
- --
Stuart Sears RHCA RHCX
To err is human, to forgive is Not Company Policy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEc2JBamPtx1brPQ4RAnQ2AJ93ERLO7kocgBj45ZwPKic3V/PgCgCeKTwx
DRvUZNxu29kuyL9vrkpWUS0=
=qdUl
-----END PGP SIGNATURE-----

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux