Search This Blog

Tuesday, September 4, 2018

Mounting a Synology SMB share on Ubuntu 18.04 using CIFS

I recently purchased a Synology DS918+ and an Intel NUC to replace my aging (and quite large) desktop machine. I wanted the same ease of access as my previous setup where I used an mdadm RAID array mounted to /mnt/Media. I knew that in order to achieve direct access, I'd need to update /etc/fstab, but how? Try to Google "synology smb mount ubuntu" and see the wide array of results.

I transferred some (4) of the desktop hard drives that were part of the RAID array to the NAS. After a day of setting it up, initializing the drives, creating the volume, and getting my Plex server going, it was time to start transferring data from my cloud backup. Once that was complete, I started my research and eventually came up with a proper fstab solution that's working for me.

Ultimately it came down to this:


  1. In your Synology DSM, go to Control Panel > File Services
  2. Check Enable SMB Service
    1. Make the Workgroup whatever you want (ie HOMENAS)
    2. Check 'Disallow access to Previous Versions'
  3. Go to Advanced Settings
    1. WINS server: leave blank
    2. Maximum SMB protocol: SMB3
    3. Minimum SMB protocol: SMB2
    4. Transport encryption mode: Auto
    5. Check 'Enable Opportunistic Locking'
    6. I left everything else unchecked
  4. Click Apply on Advanced, and Apply on the main SMB configuration screen
  5. It should look similar to this:
    Synology SMB configuration screen
  6. Over on your Ubuntu machine, create a new mounting destination and change the ownership to your login:
    1. sudo mkdir /mnt/Media
    2. sudo chown <username>:<groupname> /mnt/Media
  7. Create a credentials file in your home directory
    1. nano ~/.smbcredentials
    2. username=<synologyUsername>
      password=<synologyPassword>
    3. Save and exit (Ctrl+X, y, enter)
  8. Change the permissions of that file so that you and root are the only users that can access it:
    1. chmod 0600 ~/.smbcredentials
  9. Edit /etc/fstab to mount it automatically:
    1. sudo nano /etc/fstab
    2. At the bottom of the file, make a similar entry:
      1. //homenas.local/Media is the network name of your NAS, followed by the shared directory on the NAS
      2. /mnt/Media is the directory you just created on the local machine
      3. vers=3.0 enforces the latest version
      4. The uid=1000,gid=1000 mounts it as your login
    3. Save the file and exit (Ctrl+X, y, enter)
  10. Test the mount by mounting all entries in fstab:
    1. sudo mount -a
    2. If you received no errors, then you're good to go, and can access this folder at /mnt/Media
    3. Check the permissions to make sure they make sense:
      1. ls -al /mnt
      2. This should show your username and group as the owner
  11. Create symlinks as desired or Nautilis shortcut by dragging it into the left column


Special thanks to this post, which ultimately is what I needed to get going.

Monday, June 18, 2018

iTerm 2 setup for Cisco Labs in OS X

I recently started taking some Cisco courses online through Global Knowledge. The Cisco Labs allow you to telnet into various virtual switches, routers, and PCs through their web interface via various methods. In Windows, you can set up Putty to be the default client that is opened when one of these links is clicked:

 

This allows you to administer this virtual lab environment from your normal telnet/ssh client that you'd use for work.

Another option is to use the web telnet client:


But that is about as annoying as it sounds when you're used to your customized terminal experience. In OS X, it seemed to be the only option, and in fact, the first ICND instructor I had said as much during the course intro.

Over the first lunch break I did some research to find out that iTerm can be used to remotely access these Cisco Labs, it just takes a bit of tweaking to get there.



I use iTerm2 as my daily driver for ssh sessions at work to get into various Linux servers and networking equipment. So to use this for my labs, if I could get it to work, was a no-brainer.

  1. Create a new Profile
    1. Name it whatever you'd like. I chose "Cisco Lab Telnet"
  2. In the Command section, switch it to "Command:" then type
    1. /usr/local/bin/telnet $$HOST$$ $$PORT$$
  3. In the URL Schemes, choose telnet
     
    1. Now the telnet command from your browser will be associated with iTerm
Final settings should look similar to:



During the labs it will become necessary to telnet into multiple sessions at once. It can get a bit confusing which tab or window is which, especially in the more advanced labs. I have found that if you right-click (Opt Click) the tab title, and Edit Session, you can then rename the tab:









Now you'll have a nicely organized session to play around with:
 



Enjoy!