permission issue to move file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting permission issue to move file
# 1  
Old 12-11-2008
Question permission issue to move file

We have a script which will move the files from the each user home directory to other location to process the file in the server.

The users put files in their home directory using FTP and the user home dir have 775 permission so the the application user can move the files from the home path to other location since the application user was a group of the FTP user account.


But when users start using sftp the permission need to restict to 755 and the gorup user home path then the current script can not move files from there since group cannot have write permission

so what was the alternative way to move files from there to desired location

Please suggest ....

Its an urgent request ...
Smilie
# 2  
Old 12-11-2008
tHE SCRIPT AS FOLLOWS

# Location of the staging area
app_ROOT=$HOME
STAGING_DIR=$app_ROOT/in_staging

# Time to leave file before moving it (in minutes)
MINUTES_TO_LEAVE_FILE=10

#SFTP/FTP user home path
A_DIR=/export/home/A
B_DIR=/export/home/B
C_DIR=/export/home/C

# Transfer files for each user inturn
/usr/local/bin/find $A_DIR -name 'PN*' -type f -cmin +$MINUTES_TO_LEAVE_FILE -exec mv {} $STAGING_DIR/A \;
/usr/local/bin/find $B_DIR -name 'LY*' -type f -cmin +$MINUTES_TO_LEAVE_FILE -exec mv {} $STAGING_DIR/B \;
/usr/local/bin/find $C_DIR -name 'GT*' -type f -cmin +$MINUTES_TO_LEAVE_FILE -exec mv {} $STAGING_DIR/C \;
# 3  
Old 12-11-2008
This is quite tricky and depends on your env. especially the umask settings and the users login shell. pls provide some Information and if it is urgent provide them urgently.
# 4  
Old 12-11-2008
You could set an ACL on the home directory to give the group write access:

The command is either setacl or setfacl, depending on your distro.

Code:
setfacl -m g:groupname:rwx /home/directory

I don't believe ssh has issues with ACL's being less restrictive than regular unix file permissions.
# 5  
Old 12-11-2008
Quote:
Originally Posted by demwz
This is quite tricky and depends on your env. especially the umask settings and the users login shell. pls provide some Information and if it is urgent provide them urgently.
First of all am not root in the server.

I am doing the appication related scripts

User login shell was ksh

i am unaware about the umask seeting... sorry

One thing am sure that to enable SFTP the user should have the resrited permission ie 755 ie no one else can write on the home directory.

Please suggest on this script.

Last edited by GIC1986; 12-11-2008 at 10:19 AM..
# 6  
Old 12-11-2008
# 7  
Old 12-11-2008
if U dont have permission to move the files it will not help to modify the script. you will have th change the file permissions. this is commonly done by modifing the users umask. Also the directory permission must provide write access to be able to delete a file
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Automount permission issue

Hi all, I am running CentOS6.3 and NFS is giving me a real hard time here: on my server a folder called /networkh has created with 777 permissions. I have setup NFS server on this server and it is supposed to serve a network. On my client machine I configed my auto.master: /nethome... (1 Reply)
Discussion started by: bashily
1 Replies

2. AIX

Permission Issue

Hi Team, I am using AIX 6.1 version. I have two log id IDs say (user1 and user2) Both users primary group is same. ex (group1) I have created directory called /logs/app using user1 and permissions are like below /logs ------ drwxrwxr-x /logs/app ----- drwxrwxrwx But all the process... (3 Replies)
Discussion started by: balasubramani04
3 Replies

3. UNIX for Dummies Questions & Answers

Puzzling permission issue

I have a file, the long listing output by 'ls -l' is -rw-r--r-- 1 usera agroup 1246 Jul 7 14:44 temp.R The file is under a Solaris ZFS file system. As a different user (userb), I did cp temp.R /tmp ls -l /tmp/temp.R -rw-r--r-- 1 userb agroup 1246 Nov 16 14:45 /tmp/temp.R ... (14 Replies)
Discussion started by: nugulus
14 Replies

4. HP-UX

Permission Issue on HP-UX

Good day guys, I am very new in UNIX and am trying to install an application which uses an application ID that requires administrative privileges (Full control). In most cases, we use SUDO to grant access to this ID however the customer insisted NOT to use SUDO and Root ID is not to be used to... (1 Reply)
Discussion started by: mcdsweet98
1 Replies

5. OS X (Apple)

file permission issue

-rw-r--r-- 1 root wheel 1676 Jul 8 13:40 group -rw-r--r-- 1 root wheel 3669 Feb 25 2010 passwd -r--r----- 1 root wheel 1242 Jan 26 2010 sudoers I can read group and passwd, but i cant read sudoers.. why? I am curenttly a staff member. (1 Reply)
Discussion started by: linuxstuff101
1 Replies

6. Shell Programming and Scripting

permission denied issue

hello I m trying to enter in a folder through my script but getting permission denied error .. Is there any command or somthing else so that i can access these folder through my script. (3 Replies)
Discussion started by: urfrnddpk
3 Replies

7. Shell Programming and Scripting

issue invoking shell script using cron, even with proper file permission

I am using tcsh what could possibly be a problem, when using crontab to invoke a shell script. ? The script has the read, write and execute permission to all users. And the script works as expected while executing it in stand-alone mode. Is there a way to trace (like log) what error... (9 Replies)
Discussion started by: vikram3.r
9 Replies

8. UNIX for Dummies Questions & Answers

File permission issue

Hello All, I receive a file from another server with file permission rw-r--r-- and owner of the file is the sFTP login id and group is also different from my login id. Due to this I cannot move the file from and also cannot do anything on it. Can anyone help on how to change the file... (2 Replies)
Discussion started by: maddy911
2 Replies

9. UNIX for Dummies Questions & Answers

Sudo permission issue

folks; How can i give a group a sudo permission to execute only some command "like start/stop Apache", so every user in that group can sudo to use this as himself, i mean when he tries to sudo, he will be asked for a password (and make it so he must use his own NT password not a generic one) then... (6 Replies)
Discussion started by: Katkota
6 Replies

10. Shell Programming and Scripting

Setfacl permission issue

My Admin has written a shell script (Filepermission.ksh) with the following commands and provided me 'exeutive' privileges. However, when I try to run the script, I am getting the following error message. Can some one tell me what could be missing? Thank you for your continued support. Script: ... (0 Replies)
Discussion started by: MeganP
0 Replies
Login or Register to Ask a Question