ssh, scp, su -i -u someuser

Today I struggled with downloading a file through ssh.

I can ssh through server with account quynh.nguyen. However, in order to read the file, I must use another account

sudo -i -u someuser

Then when I issue a request to download a file from remote server to local machine. It’ll ask me for the password of someuser, which I do not have. I only have password of user quynh.nguyen.

scp ~/local_directory

The solution seems to be trivial, but I spent around 3 hours with the help of some friends to figure it out.

  1. ssh to server with quynh.nguyen account
  2. Use the shell of someuser
  3. scp to copy file from someuser to quynh.nguyen home folder. Then I’ll input the password for user quynh.nguyen
  4. scp to copy file from home folder of quynh.nguyen to local folder in my machine

Below is the code:

  1. ssh ....
  2. su -i -u someuser
  3. scp /home/someuser/some_file.txt
  4. scp* ~/local_directory 

1st problem –

the first { [ (prls6_36 – prime_36) << 7 ] – 1 } digits after decimal of Pi, in MD5

Useful links:

Other notes:

  • the first digits: notice that “digits” is in plural form. When I first read this problem, I was thinking that I only need to brute force the MD5 for 10 integers from 0 to 9, then I’d get the result.

How I solve that one? I just read the file that contains 1,000,000 digits of number after decimal of Pi, then perform a little bit of arithmetic use a library to know the MD5 of a string.