Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chmod

Status
Not open for further replies.

kumariaru

IS-IT--Management
Mar 9, 2006
61
0
0
AU
Hi All,..
I am getting a file which is created in Excel and converted .csv. The permission given to this .csv are shown like this -rw-r----- . I am doing a ftp'ing.This file is transfered through datastage to other server.Where i am using this script to FTP:(a part in the script where chmod is used):

if [[ $cmd = "put" || $cmd = "append" ]]; then
echo "open $server
user $user $pwd
cd $tdir
$cmd $files
quote site chmod 777 $files
quit " | ftp -n -v > putfiles${jobid}.log
fi

I am succesfully able to put the file in the server.From this server the file as to get moved to other server, but this can not move to other server because of permission issue. how can i slove this...i have to put this file..........

Thank you..




 
Are you getting any feedback about the chmod in the log file?



IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
No, I am getting any thing in log file.
 
On the server where the permissions are [tt]-rw-r-----[/tt], are you the either the owner or a member of the group assigned to the file?

Could you describe the problem again for clarification, using unique names for the different computers involved and when you mention a script or permissions include which machine the script or file is on?

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
Hi Rod,
I am working on unix sunsolaris system. I am not sure with the permissions given. i have a script which FTP a file and place it on one server(s1).Next I have to ftp the file from s1 to other server(s2).
I can not view the permission given to us intially (before ftp the file to s1)but after placing the file in the server s2 , I can see the file with permissions:

-rw-r----- 1 etloft user 990 Apr 10 16:21 STGE.csv

I think i am the owner(etloft) while placing the file in final server(s2).Now, the "user" has to move the file to his server from servers(s2). But you can see the permissions(are not given). I have used "chmod 777" to place the file with permissions to the user in server s2" and the above scripts realtes to this. I am sorry , I am new to shell scripting.

 
Look for a file called [tt]/etc/default/ftpd[/tt] on the system that you are sending the files to. See if it has "[tt]UMASK=026[/tt]" in it. That sets the default umask on the receiving side. If you change that to "[tt]UMASK=000[/tt]", it will make incoming files readable and writeable by anyone.

If the receiving system is Solaris 10, look in [tt]/etc/ftpd/ftpaccess[/tt]. And the parameter will be "[tt]defumask[/tt]" (see the man page for usage).

You can check to see if the "[tt]quote[/tt]" or "[tt]site[/tt]" commands are even supported on your receiving system by ftp'ing to it and giving the commands "[tt]remotehelp quote[/tt]" and "[tt]remotehelp site[/tt]". If they are not supported or implemented, you will have to set the umask on the receiving side like I describe above.

Is the site command is supported, you might also try changing your code to...
Code:
if [[ $cmd = "put"  || $cmd = "append" ]]; then
    echo "open $server
    user $user $pwd
    [b]site umask 000[/b]
    cd $tdir
    $cmd $files
    quit " | ftp -n -v > putfiles${jobid}.log
fi
That won't set it to 777, but anyone will be able to read and write it which is what you're looking for.

Hope this helps.
 

Hi Sam,
I opened the umask(/usr/bin/umask). And I am seeing this code(where there umask is set to zero):

command=`/usr/bin/basename $0` # Invoke the ksh builtin
if [ "$command" = "type" ]
then
whence -v "$@"
elif [ "$command" = "hash" ]
then
alias -t - "$@"
else
$command "$@"
fi

thank you
 
This doesn't mean anything. That's just because there is no [tt]umask[/tt] program to run. This just makes you use the [tt]umask[/tt] built into your shell if you ever specify [tt]/usr/bin/umask[/tt].

Try checking the things I mentioned in the email above.
 
Hi Sam,
How can I do that....
I tried using the code given by you but still the permissions are not given to the file....

Thank you
 
Was there an error message when your script did the "[tt]site umask 000[/tt]" command? If so, what was it?

Does the system you are sending the files to have a [tt]/etc/default/ftpd[/tt] file on it? Did you put the line "[tt]UMASK=026[/tt]" into it?

Did you ftp to the site that you're sending files to and type the commands "[tt]remotehelp quote[/tt]" and "[tt]remotehelp site[/tt]"? If so, what was the response to those commands?

Don't just say it didn't work, we can't see your screen from here. You have to let us know what you did, and what error messages and symptoms you got when it didn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top