sudo su && cp /home/sk/keys/master.pem /home/sg-user/keys/
This runs the command
sudo su runs an interactive shell as root, it is basically equivalent to
sudo -s or
sudo bash (if your shell is bash). Once this command has finished, if it returned a success status, the
cp command is executed as the original user.
As far as the shell is concerned,
sudo is an ordinary command, not special shell syntax. So, like with any other command,
&& is a command separator, and the command on its left is executed first, then the command on its right (if the first command was successful).
sudo su && cp /home/sk/keys/master.pem /home/sg-user/keys/ && exit
This variant does the same, except that it exits the parent shell once
sudo su returns and the file has been copied (assuming those operations were successful). The
su command runs an interactive shell, which runs the commands that you pass it as input, not the commands that the parent shell is going to run later.
If you want to run two commands as root, running the second one only if the first one succeeded, you can invoke
sudo command1 && sudo command2
or you can make
sudo invoke a shell and use the
&& operator in that nested shell:
sudo sh -c 'command1 && command2'
In your case, you're only running a single command, so it's just
sudo cp /home/sk/keys/master.pem /home/sg-user/keys/
sudo su is basically always useless, because both
su are used to change users. Since
sudo already runs the specified command as root,
su is redundant. This just runs a shell as root, which you can do with