Changing permissions of the file, while using sftp command in a shell script
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 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 usingsftp
in the context of a shell script. How are you passing the commands tosftp
? 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
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
37k1052121
37k1052121
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 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 usingsftp
in the context of a shell script. How are you passing the commands tosftp
? 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
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 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 usingsftp
in the context of a shell script. How are you passing the commands tosftp
? 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
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 |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 tosftp
? 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
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