I want to install Ubuntu and I would like to set my /home partition in an external USB hard drive that is directly connected to my router, and access my data through the LAN connection. Can it be done?
Executive summary: Yes, you can do this, but it will not work very well, because the drive probably doesn't support Unix-style permissions.
You can make your home directory exist on a remote filesystem rather than the local computer. (If you do that, you might want to have another user account, to use for troubleshooting if a problem develops with the remote share.)
However, to work properly, home directories should be on volumes that support Unix-style file permissions. Your router probably uses SMB/CIFS to share the drive. Such permissions can be exposed well enough through Samba, so if you're using SMB/CIFS (Windows file sharing) to share a drive that is formatted with a Unix-style filesystem, this can work (though your router would likely be incapable of that).
The drive probably does not have a Unix-style filesystem. It probably has NTFS, FAT32, exFAT, or (if it's quite small), FAT16. The FAT filesystems don't support any system of permissions at all. NTFS supports permissions, but it's a different system from Unix-style permissions.
So yes, you can do this. You can edit
A better approach may be to make certain folders inside your home directory (like