Let's assume that I am on-site at a host location. I use a direct connection to get access to the host by hacking a slaved device with direct access. So now I want to control some doors and cameras which are slaved to the host.
This mean that you got to place your mark on the host without fighting host ratings. But this mean physical proximity. You probably need to watch out for physical patrols and drone patrols etc. Might require investment into stealth and agility etc. Or social engineering skills.
Do I roll against host+firewall or against the device ratings?
Once you have access on the host you may enter it. Once you are inside the host you are considered directly connected to all devices out on the grid that are slaved to the host. That mean that they don't get to use host ratings when you hack them (and you will be considered to be zero meters away from the device no matter where in the world it is physically located). The device will typically defend with a dice pool of 4 (or perhaps 6) dice (the GM typically just roll against illegal actions to see if any OS was generated). The drawback is that you are now inside the host that is patrolled by IC and perhaps also a spider decker.
If you instead attack the slaved device out on the grids without first entering the host then it get to defend using host ratings (this is actually the only scenario where it get to use host ratings when defending). In this scenario you are also subject to noise (for example due to distance). The advantage is that there will be no IC to worry about (they only exists within hosts).
Second: Now I want to access a file on that server. Do I have to roll against the file with hacking on the fly to get marks on the file or would I roll against the host?
You are not considered directly connected to files.
Files will defend with host ratings when you try to place your mark on it or when you try to copy them.
Hacking a host should not be such a big issue if you have a direct connection, but hacking a file is always difficult. So why do most builds include "Hacking (hosts)"?
Hacking host with a direct connection mean physical proximity.
You typically need to sneak and avoid physical guards and drones.
Advantage is that you don't have to fight host ratings.
Hacking host (or devices) remotely mean you need to fight host ratings.
You typically need dedicated hacker with huge dice pools.
Advantage is that you don't need to worry about physical guards.
Pick your poison :-)
Would I use control device or spoof command to open doors and to disable traps and guns? To control a gun I would use control device. But for simply disabling? Would a mark on the host (which I gained through hacking a directly connected device) be sufficient for spoof command?
Spoof Command is illegal and will potentially build OS. If you have a mark on the owner you can use it to open a door you don't have a mark on. This is also what you have a mark on the owner and want to send an instruction to one of the owner's drones to have the auto pilot of the drone to take an action on its own, using its own initiative score, pilot rating and autosofts it might have access to. Your instruction will be ignored if someone is already remote controlling or is already jumped in. Spoofing commands can be done from AR or VR.
Control Device require that you already have access on the specific device (that you have your marks on the device). If you have a mark on a door then you can use this action to open it with a free action (as if you would have been a legal user) without causing overwatch score. This is also what you typically use if you want to control a drone yourself, overriding the auto pilot, using your own initiative score, your own attributes and your own skills. Control Device override autopilot (or under manual control unless the vehicle have a manual control override mod) but you can not control a drone that someone else is already remote controlling or is already jumped into. Remote control can be done from AR or VR.
Jump into rigged device require that you have three marks on the drone and that you have a control rig implant. This let you override both autopilot and remote control (but you can not jump into a drone that someone else is already jumped into). Jumped in can only be done from VR and it reduce thresholds, increase limits and you also get a positive dice pool modifier.