You are looking for umask. umask is a shell builin that will decide what will the default permission of a newly created file. The value of umask can vary from user to user.
To check the umask value of the current user, run umask in the terminal:
$ umask
0002
The first 0 indicates the absence of SUID/SGID/Sticky bit, it is the default first bit value so if we don't need to set any of those three bits we usually don't use this bit.
The umask value is actually deducted from 777 (in case of a directory) and from 666 (In case of a file) to get the permission of a newly created file/directory. So, if the umask is 0002 the newly created file by this user will have a permission of (666 - 002)=664 and a directory will have (777 - 002)=775.
To change the umask value for only current user permanently, put the umask value at the end of the ~/.bashrc of the user. For example:
echo "umask 022" >> ~/.bashrc
For changing temporarily, run:
$ umask 022
The global umask value can be found and changed from /etc/login.defs:
$ grep "^UMASK" /etc/login.defs
UMASK 022
****Note than you should not use chmod/chown randomly unless you are absolutely sure about the outcome.
umaskmode creation?755is for a folder for a regular file is666if yourumaskis0022every new file created will have permissions644not755is this your issue? Or I misunderstood?:) – JoKeR Apr 08 '15 at 10:00