Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
No, for a file you should get 644.
A file is never executable by default, you have to set that manually (and this is the difference between 755 & 644).
A directory, OTOH, must be 'executable' or you can't descend into it.
But you wrote you get 666 or was that a typo?
Better set umask to 011 or 001, so you will get permission of 655 (i.e. rw-r-xr-x) or 665 (i.e. rw-rw-r-x). In that case file will be executable for all.
No, for a file you should get 644.
A file is never executable by default, you have to set that manually (and this is the difference between 755 & 644).
A directory, OTOH, must be 'executable' or you can't descend into it.
But you wrote you get 666 or was that a typo?
ok - so, there is no other way to set file permission to 755? like umask? something that we can setup in the profile?
i get 666(rw-rw-rw) for a file if my umask is "umask 000"
I don't really understand why you want that?
Why would you want every file to be executable - and for everybody!
That is definitely not good practice, but maybe you have special needs. Can you please tell why you want this?
I don't really understand why you want that?
Why would you want every file to be executable - and for everybody!
That is definitely not good practice, but maybe you have special needs. Can you please tell why you want this?
Then why not you set umask to 026? Even if there's no execute permission for owner, but he's will be able to execute the file, because he'll be in group of the file and group has already execute permission...
But why do you want *every* file you create executable?
Think about it, if every document, picture, html-page, whatever you create will be executable, then one day you might find ththa you accidentally executed code when you just wanted to read a document.
Just one example, but there is a reason for why exec must be set explicitly.
If you're writing scripts, you most likely put them in one directory, then it's not really a big hassle to make them executable using chmod?
One thing you could do, if you write your scripts with a specific program you cold write a small shell script that makes the files executable.
Like this:
my_wrapper_file:
Code:
#!/bin/bash
touch $1
chmod ug+x $1
kate $1
Then you start it with
my_wrapper_file script_file_name
And script_file_name will be executable.
But why do you want *every* file you create executable?
Think about it, if every document, picture, html-page, whatever you create will be executable, then one day you might find ththa you accidentally executed code when you just wanted to read a document.
Just one example, but there is a reason for why exec must be set explicitly.
If you're writing scripts, you most likely put them in one directory, then it's not really a big hassle to make them executable using chmod?
One thing you could do, if you write your scripts with a specific program you cold write a small shell script that makes the files executable.
Like this:
my_wrapper_file:
Code:
#!/bin/bash
touch $1
chmod ug+x $1
kate $1
Then you start it with
my_wrapper_file script_file_name
And script_file_name will be executable.
ok - here my situation..
we have a application that moves files from source to destination.
after moving to destination the files are getting "rw-rw---"
in order to use the files in the destination it should have executable for user and group(i.e rwxr-x---)
Aha, I see the situation now!
Now this depends a bit on exactly how the files are copied or moved, also I believe it matters to & from what media.
Like for instance if the application runs a simple bash script, then you could modify that script to keep permissions.
So, what app, from where, to where?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.