1

Scenario:

I have access to a linux server A whose credentials are managed via a PAM server. I want to copy a file to this server from a remote server B whose credentials i have.

Challenge:

SCP from server B to copy files to server A wont work as i don't have the credentials to server A.

Problem:

Server A and B are part of a restricted network meaning the only way to get these files to server A is only from server B.

Question:

Is there a way to fetch the files from server A prompting for credentials for server B.

7
  • SCP suggests ssh ... so, you would need to login on one and scp to/from the other ... so you would need credentials of some sort on both - that's how security works Commented Sep 19, 2024 at 5:59
  • It sounds like you don’t have credentials to the server, you will need to acquire an account, so you can access the server from the original server you currently have access to Commented Sep 19, 2024 at 6:36
  • Got two solution to this from a friend, let me share for future reference Solution one: SCP Fetches the file from the remote server using scp command using the remote server credentials example scp [email protected]:/home/myuserB/archive* /home/usera/ will copy all the archive files in the servers 192.168.100.2 home/myuserB/ directory to the /home/usera/ directory. This will prompt for userb credentials Commented Sep 19, 2024 at 7:24
  • Solution two: rsync Using rsync to schronise files between two directories. This is great especially for large files. Command rsync -avz [email protected]:/home/myuserB/archive* /home/usera/ Does the same as the above command for scp. Tried both solution on my RHEL 9.4 server and worked okay. Commented Sep 19, 2024 at 7:24
  • Thank for the responses upon realizing the solution its looks so simple but clearly the situation was overcomplicated by the restrictions. Commented Sep 19, 2024 at 7:28

1 Answer 1

0

Got two solution to this from a friend, let me share for future reference

Solution one: SCP Fetches the file from the remote server using scp command using the remote server credentials, you can get more details from the link https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/

example scp [email protected]:/home/myuserB/archive* /home/usera/

will copy all the archive files in the servers 192.168.100.2 home/myuserB/ directory to the /home/usera/ directory. This will prompt for userb credentials

Solution two: rsync Using rsync to schronise files between two directories. This is great especially for large files. Refer to the link below for additional details https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories

Command rsync -avz [email protected]:/home/myuserB/archive* /home/usera/

Does the same as the above command for scp. Tried both solution on my RHEL 9.4 server and worked okay.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Sep 19, 2024 at 9:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.