Ubuntu – Connecting to a server via the command line

14.04command linenetworkingssh

Newbie networking question here…

So, I have followed some instructions from my university to connect to my personal space on the university network. The instructions are to open Nautilus, then under Network on the left-side panel, choose Connect to Server, where I then enter smb://foo.bar.com/user into Server Address, where foo.bar.com is the address of the network, and user is my username.

This works fine, and I can then browse my personal space. However, I want to do some more complicated things than simply browsing, such as changing the permissions of various files. And I would like to be able to do this from the command line as I have been used to in the past.

So, what I tried to do is to ssh into this network. I'm not really sure whether ssh is the right thing to be doing here, and what it really does anyway, but I had heard that this is the way to connect to servers through the command line. So, in the command line, I tried entering ssh foo.bar.com, which then asked me for my password. But after entering my password, I got a message saying:

Connection closed by xxx.xxx.xxx.xxx,

where xxx.xxx.xxx.xxx is an IP address which I have determined is the exact IP address of the server I am trying to connect to. This message appears even after I have closed my other connection to this server from Nautilus.

So, this may be an internal issue with my university which I need to resolve, but before I do that, is this the correct way I should be trying to access the server from the command line? Or is there another way which is more typical and might work for me?

Thanks!

Best Answer

While ssh is not the same as Samba, and therefore it was likely that you failed, you can do a cifs-mount for a Samba-shared directory:

  • create a folder in your (Johnny's) home dir e.g. mkdir univerity_space
  • then connect via

    sudo /bin/mount -t cifs -o user=UNIVERSITY_USERNAME,uid=1000,gid=1000 //foo.bar.com/user /home/johnny_johnson/university_space

    check that your local (Ubuntu) user ID and group ID is 1000 via echo $UID (that is under which username and group the folder permissions are to be set on your Ubunut machine, i.e. it should be Johnny's in the end). It might be another number, just take that then.

  • you will be prompted for the password

  • disconnect via sudo /bin/umount /home/johnny_johnson/university_space

Note that the permissions you are setting now are permissions in terms of your local Ubuntu machine. See for @madneon's answer on the differences of ssh and Samba.