Yes, once the units of first account are fully away, you can attack it with another account. In other words - if the system allows it, it's allowed.
Correct, and the games very good at warning you if ip share is involved.
But, you can send ships to free a port by player A with one account and attack that players other town with another account that you have ip shared.
If your defending your town.
One account can defend and another can attack and thats the only way.
It's a lot of work fighting with shared accounts, especially against illegal multis which are dominating most servers right now.