RE: Batch file Permissions

  • From: "Bobak, Mark" <Mark.Bobak@xxxxxxxxxxxx>
  • To: "Richard.Goulet@xxxxxxxxxxx" <Richard.Goulet@xxxxxxxxxxx>, "krishna000@xxxxxxxxx" <krishna000@xxxxxxxxx>, "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 17 Sep 2009 12:56:18 -0400

Hi Bala,

A minor correction to Dick's comment, -rw-r--r-- is 644 not 344.

Default file permissions are controlled by the umask of the process creating 
the file.  The default umask is 022.  That gets and'ed with the default 
permissions for a file and a directory.
For a file, default permissions are 666, anded w/ umask of 022, you get 666&022 
= 644 = -rw-rw-rw-
For a directory, default permissions are 777, anded w/ umask of 022, you get 
777&022 = 755 = drwxr-xr-x

The important point though, is that you'll never be able to get 755 on a file 
by default.  Since the default permission, without any umask at all, is 666, 
the most permissive you can get is 666, if you set umask to 000.

I think this is a security thing.  If you want a file to be executable, you 
need to explicitly set it as such.  It will never happen by accident or default.

Finally, if you need to change the umask for your ftp daemon, you'll need to 
work with your sysadmin to make the change in the /etc/init.d script that 
starts your ftp daemon, in order for it to see the change to the umask value.

Hope that helps,

-Mark

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Goulet, Richard
Sent: Thursday, September 17, 2009 12:36 PM
To: krishna000@xxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: RE: Batch file Permissions

Bala,

    I've tried ftp commands to a couple of the linux/unix servers we have here. 
 The file gets there with a file mask of 344 (-rwr--r--) is my math is right.  
Why would you need to have them as 755 (-rwxr-xr-x) if it's a daily process??


Dick Goulet
Senior Oracle DBA/NA Team Lead
PAREXEL International


________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Balakrishna Y
Sent: Wednesday, September 16, 2009 11:34 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: Batch file Permissions
Hi all,

I am trying to automate ftp from windows to Linux machine.

My Batch file looks like this . The problem is by default while shipping the 
file i wanted to give permissions to files as 755 . Can any one help me out .

@echo off
SET CUSTOM=/apps12i/oracle/KIRAN/
apps/apps_st/appl/custom/12.0.0/reports/US
echo user oracle> ftpcmd.dat
echo passwd >> ftpcmd.dat
echo bin>> ftpcmd.dat
echo cd %1 >>ftpcmd.dat
echo put %2 >> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ipaddress
del ftpcmd.dat

Regards

Bala

Other related posts: