This is possible. Using a normal USB cable, you can create a network that the computers can communicate over.
If you connect your Nexus 7 running Ubuntu to your PC running Ubuntu, your PC will detect the USB connection as a new network connection via a "CDC Composite Gadget". Your Nexus 7 will detect the connection as an Ethernet Network. Both will sit there trying to connect to the other, but don't know how. To make them communicate, you'll need to set up a network and give them each an IP. Once you've done that, you can transfer files through the network you made, and the files will be transferred via USB.
Setting Up the Network
On the Nexus 7, click your network icon and then click "Edit connections...". In the window that pops up, make sure you're in the "Wired" tab, select "Wired connection 1" and click "Edit...". Go to the IPv4 Settings tab and change Method to "Manual". Next, click the Add button to the right of the addresses section, and input
192.168.10.2 as the address and
255.255.255.0 as the netmask. You can leave the Gateway blank. Now click Save... and you should get a notification that says Wired connection 1 is connected.
The Nexus 7 is set up, now let's set up the PC.
The process will be mostly the same. Click your network icon, but before you click "Edit connections...", check which connection uses the CDC Composite Gadget by looking at the list of connections. Mine is Wired connection 3, but yours will probably be Wired connection 2.
Go ahead and click on "Edit connections...", then, in the window that pops up, make sure you are in the "Wired" tab and click on the connection that uses the CDC Composite Gadget (Mine is Wired connection 3), then click the "Edit..." button. Just as before, head to the "IPv4 Settings" tab, change the Method to "Manual", and click the "Add" button. This time, though, we're going to use a different address- Enter
192.168.10.1 as the address, and the same
255.255.255.0 as the netmask. Now click "Save..." and you will get a notification saying that you're connected. The network's been set up! Your computer should remember this next time you connect the USB cable, too.
Now you can use Samba, SSH, SFTP, NFS, or any other network-based file transfer software to transfer files between the two systems. Just remember that the IP for the PC is
192.168.10.1 and the IP for the Nexus 7 is
192.168.10.2. Here's an example on how to copy files from your PC to the Nexus 7 using sshfs:
Open a Terminal on the PC. Run
sudo apt-get install sshfs to make sure sshfs is installed, then create a folder to mount the files into, like
~/ssh-mount. Now you're going to need to use sshfs to mount the folder on the Nexus 7. To do this, run
sshfs [email protected]:/home/user ~/ssh-mount, keeping in mind that:
user should be replaced with the username of the the user on the Nexus 7
192.168.10.2 is the IP address of the Nexus 7 through the usb cable
/home/user is the name of the remote directory (on the Nexus 7) you're mounting
~/ssh-mount is where you're mounting it to.
Press enter and the program will say something about the key authenticity, just type
yes and enter your password (the password of the user on the Nexus 7). It should just put you at a prompt, at which point if you navigate to
~/ssh-mount on your PC, you will see the contents of
/home/user on your Nexus 7. You can also do the same thing in reverse between the Nexus 7 and the PC, if you wish.