Q:

Using "&" and "|" in SSHPass script

I am making a script for my parents on their Mac's so that they can SSH into my Linux computer, and send commands, create popups etc. 
This is one of my commands:
sshpass -p Password ssh maliciouzzhd@10.0.0.1 export DISPLAY=:0 & mate-session-save --force-logout

My problem is that the Mac treats the "&" as not in the sshpass script, and executes the argument after using the Mac terminal, no SSH. 
So
sshpass -p Password ssh maliciouzzhd@10.0.0.1 export DISPLAY=:0 & mate-session-save --force-logout

would execute
export DISPLAY=:0

in the SSH session, but
mate-session-save --force-logout

would be executed in the Mac terminal. 
If anyone could help me out with this, it would be greatly appreciated. 

A:

SSH accepts single argument as a command, not multiple ones, so the command line should look like this (note the quotes):
sshpass -p Password ssh maliciouzzhd@10.0.0.1 "export DISPLAY=:0 & mate-session-save --force-logout"

But the general idea might not work, because you didn't allow X11 forwarding (add -Y switch to the ssh).