Changing permissions of the file, while using sftp command in a shell script

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
How can I change the permissions of the file/command, while using the sftp command via a shell script? My sftp connection is established, but it fails while executing the chmod command.
As of now, I am using chmod 775, which exits without creating proper permissions in the target directory.
shell-script chmod sftp
 |Â
show 2 more comments
up vote
1
down vote
favorite
How can I change the permissions of the file/command, while using the sftp command via a shell script? My sftp connection is established, but it fails while executing the chmod command.
As of now, I am using chmod 775, which exits without creating proper permissions in the target directory.
shell-script chmod sftp
Is there any error message? what is the login used to connect ? what is the result ofls -l filenamevia sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?
â Jay jargot
May 15 '16 at 21:13
You say that you're usingsftpin the context of a shell script. How are you passing the commands tosftp? If you're using the-bswitch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.
â DopeGhoti
May 15 '16 at 21:14
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01
 |Â
show 2 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
How can I change the permissions of the file/command, while using the sftp command via a shell script? My sftp connection is established, but it fails while executing the chmod command.
As of now, I am using chmod 775, which exits without creating proper permissions in the target directory.
shell-script chmod sftp
How can I change the permissions of the file/command, while using the sftp command via a shell script? My sftp connection is established, but it fails while executing the chmod command.
As of now, I am using chmod 775, which exits without creating proper permissions in the target directory.
shell-script chmod sftp
shell-script chmod sftp
edited May 15 '16 at 23:36
Jeff Schaller
32.7k849110
32.7k849110
asked May 15 '16 at 20:43
Sravani
612
612
Is there any error message? what is the login used to connect ? what is the result ofls -l filenamevia sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?
â Jay jargot
May 15 '16 at 21:13
You say that you're usingsftpin the context of a shell script. How are you passing the commands tosftp? If you're using the-bswitch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.
â DopeGhoti
May 15 '16 at 21:14
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01
 |Â
show 2 more comments
Is there any error message? what is the login used to connect ? what is the result ofls -l filenamevia sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?
â Jay jargot
May 15 '16 at 21:13
You say that you're usingsftpin the context of a shell script. How are you passing the commands tosftp? If you're using the-bswitch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.
â DopeGhoti
May 15 '16 at 21:14
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01
Is there any error message? what is the login used to connect ? what is the result of
ls -l filename via sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?â Jay jargot
May 15 '16 at 21:13
Is there any error message? what is the login used to connect ? what is the result of
ls -l filename via sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?â Jay jargot
May 15 '16 at 21:13
You say that you're using
sftp in the context of a shell script. How are you passing the commands to sftp? If you're using the -b switch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.â DopeGhoti
May 15 '16 at 21:14
You say that you're using
sftp in the context of a shell script. How are you passing the commands to sftp? If you're using the -b switch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.â DopeGhoti
May 15 '16 at 21:14
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
- Change the permission for the file at your end before connecting to server via SFTP, same as how you want to write permissions at server
- Connect to server via SFTP
- use -p option in put
sftp> put -p
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
- Change the permission for the file at your end before connecting to server via SFTP, same as how you want to write permissions at server
- Connect to server via SFTP
- use -p option in put
sftp> put -p
add a comment |Â
up vote
0
down vote
- Change the permission for the file at your end before connecting to server via SFTP, same as how you want to write permissions at server
- Connect to server via SFTP
- use -p option in put
sftp> put -p
add a comment |Â
up vote
0
down vote
up vote
0
down vote
- Change the permission for the file at your end before connecting to server via SFTP, same as how you want to write permissions at server
- Connect to server via SFTP
- use -p option in put
sftp> put -p
- Change the permission for the file at your end before connecting to server via SFTP, same as how you want to write permissions at server
- Connect to server via SFTP
- use -p option in put
sftp> put -p
answered Nov 21 '17 at 10:29
Shyam
1
1
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f283332%2fchanging-permissions-of-the-file-while-using-sftp-command-in-a-shell-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Is there any error message? what is the login used to connect ? what is the result of
ls -l filenamevia sftp? what is the result and error message if you do it manually? Could you edit the Question and provide this information?â Jay jargot
May 15 '16 at 21:13
You say that you're using
sftpin the context of a shell script. How are you passing the commands tosftp? If you're using the-bswitch, I cannot replicate your problem; I have successfully used it to upload a file and change its permissions.â DopeGhoti
May 15 '16 at 21:14
1) the only error message i receive is invalid command. the command, i pass through the script is quote site chmod 750 $file.txt, after the put command. The put is successful. When, i do it manually, i am not receiving any error. It is successful. Only when done via script it errors me out. there are 2 files i ftp and both are able to be sftp'ed.
â Sravani
May 16 '16 at 14:55
I am passing the commands via a script. I am not using the -b. I specified all the parameters in the script first and then pass the parameters in the command.The only commands i used in the script is sftp username@hostname put file1 put file 2 quote site chmod 775 file 1 quote site chmod 775 file 2 is there any other command i have to use, when i am doing the sftp and trying to do chmod.
â Sravani
May 16 '16 at 14:57
sftp username@hostname put file1 put file2 quote site chmod 750 $file1 quote site chmod 750 $file2 quit EOF
â Sravani
May 16 '16 at 15:01