View on GitHub

Settings_Linux

Useful bash scripts and settings for managing a Linux server

Instructions on how to connect to the server(s)

Last updated 2020-06-25 by Adam Lu


  1. Relax

    • Pick your favorite juice or beer and drink it in one sitting.
    • Let Adi Narahari know how much you enjoyed it.
  2. Request for an account

    • Ask a Beenhakker lab member to set up an account for you.
    • He or she will send you back your login user name and the default Unix password.
  3. If you are off campus, set up the UVA Virtual Private Network.

  4. If you are on campus, check your IPv4 address:

    • Check your public IP address via this link.
    • Alternatively, on Mac or Linux: In a local terminal, type ifconfig (Mac or Linux) or ip addr (Linux) and choose the IP address (the first number after the keywordinet) that is not 127.0.0.1
    • Alternatively, on Windows: Open a command prompt (you can type cmd at the search bar next to the Windows button) and type ipconfig. The IPv4 address should be on the third line.

    Then send a Beenhakker lab member your IP address so that we can add it to be excepted by the firewall. If you are on VPN off campus, you will already have access through the firewall so you can skip this step.

  5. Access the server via a terminal and change your Unix password

    • Access the server via a terminal. For Windows, it’s easiest to use MobaXTerm, which can be set up via instructions here.
    • Upon prompt, enter the default Unix password provided by the Beenhakker lab.
    • Change your Unix password to something you can remember but not too simple (our server has been hacked before!).
    • Log in again (on MobaXTerm, just press R to refresh) with your new Unix password.
    • If you need to change your Unix password in the future, type the following:

      passwd
      
  6. Access shared folders through the Samba server

    • Access the server through a terminal and type the following command to change your Samba password:

       smbpasswd
      

      Your old Samba password is the same as the default Unix password.

    • On Mac:

      • Make sure Finder is being displayed on your menu bar located at the top of your screen where the apple icon is located.
      • On the menu bar click on Go and click on connect to server at the bottom of the drop down menu.
      • For the server address type smb://172.28.76.139/shareX (fishfish) or smb://172.28.77.1/barrettlab (chalkboard) and click connect
      • Open a new Finder window and on the left panel scroll until you see the category Shared. Under shared you should see the server address displayed.
      • Click on the server address
      • When prompted, enter your new Samba password
    • On Windows:

      • Open a File Explorer and click on This PC (or My Computer or My PC).

      • Right click and choose Add a network location. This is in general faster and more robust than mapping the drive.

      • Click Next twice, then enter the network address for the shared folder you want to access, for instance: \\172.28.76.139\shareX (fishfish) or \\172.28.77.1\barrettlab (chalkboard)

      • When prompted, enter your new Samba password

      • Note: if the Windows username and password does not match that of the server, this might not work. In this case, see these instructions to map a server drive.

  7. Access a graphical desktop

    • Option 1: X2Go

      • Download the X2Go Client.
      • For Mac only:
        • Also download X Quartz
        • Make sure the operating system is updated
      • Create a new session with these Session preferences:

        • Host: 172.28.76.139
        • Login: username (e.g., mark)
        • SSH Port: 22
        • Session type: XFCE
        • Connection speed: LAN
      • Click on the session you created and enter your Unix password
      • Click yes when prompted to trust the host key
      • Click and drag to resize. Do not click the maximize button
    • Option 2: VNC

      • Download the VNC Viewer

      • Set up your custom VNC sessions environment via instructions here

      • Check your screen resolution (Windows: Right click on the desktop -> Screen resolution)

      • Open a terminal (use MobaXTerm for Windows) and type one of these commands to start a VNC session with the appropriate geometry:

         # Open a VNC session with geometry 1920 dpi x 1080 dpi
         vncserver -geometry 1920x1080
                 
         # This alias (valid for all current users on fishfish) is equivalent to the command: vncserver -geometry 1366x760
         vncsmall
                 
         # This alias (valid for all current users on fishfish) is equivalent to the command: vncserver -geometry 1920x1020
         vnclarge
        

        You will see an output like this:

        New ‘fishfish:1 (adam)’ desktop is fishfish:1

        Starting applications specified in /home/adam/.vnc/xstartup Log file is /home/adam/.vnc/fishfish:1.log

        Note the session number (It’s 1 in the above example).

      • Open the VNC Viewer

        • Create a new session (File -> New Connection or right click then New Connection or press CTRL + N) with these settings (replace 1 with the session number you got):
          • VNC Server: 172.28.76.139:1
          • Name: fishfish-1
        • When prompted, enter your VNC password
      • If you forget which VNC sessions you have, type the following command:

         # htopcommand is in adams_commands.sh
         htopcommand vnc
                 
         # Equivalently, use this alias:
         vncsessions
        
      • To terminate a VNC session, you must type this command in a terminal opened with MobaXTerm (replace 1 with the session number you got):

         # Kill the 1st VNC session for this server
         vncserver -kill :1
                 
         # Equivalently (valid for all current users on fishfish), use this alias:
         vnckill :1
        
    • (Note: This is already done for all current users of fishfish) In a graphical desktop, open a terminal emulator and type the following command:

       # setup_desktopfiles.sh is in /usr/local/bin
       bash setup_desktopfiles.sh
      

      Icons for MATLAB, RStudio, etc. should show up on your graphical desktop.

  8. Open MATLAB, ImageJ, RStudio, Jupyter Notebook or Spyder

    • Method 1:

      1. Access a graphical desktop (see step 7) with the X2Go Client or the VNC Viewer.
      2. Click on the corresponding desktop icon.
    • Method 2:

      1. Access a graphical desktop (see step 7) with the X2Go Client or the VNC Viewer.

      2. Open a terminal emulator.

      3. Type the corresponding command:

        ```bash # Start the latest version of MATLAB with the GUI matlab

        # Start MATLAB R2020a with the GUI (available for chalkboard) matlab2019

        # Start MATLAB R2019b with the GUI (available for fishfish) matlab2019

        # Start MATLAB R2018a with the GUI (available for fishfish & chalkboard) matlab2018

        # Start MATLAB without the GUI starting with a specific command matlabnodisplay “cd ‘/media/shareX/’”

        # Start ImageJ imageJ

        # Start Anaconda Navigator anaconda-navigator

      # Start RStudio rstudio

      # Start Jupyter Notebook
      jupyter-notebook
        
      # Start Spyder 3  spyder
      ```
      
    • Method 3:

      1. Access a terminal (use MobaXTerm for Windows).
      2. Type the corresponding command as in Method 2.
    • Notes:

      • If you use Method 2 or Method 3, the program will be closed if the terminal is closed. This will make it easier to kill a crashed session, but you run the risk of closing the terminal by accident
      • X2Go sessions will still be running when closed. Therefore, with Method 1 or Method 2, one can close a session from one computer and open it up in another. However, processes seem to run slower when the session is closed. To terminate a session, one has to Click the Log Out ... option on the upper right corner of the XFCE desktop.
      • If Jupyter Notebook is opened with Method 2 or Method 3, after it’s closed, one must press CTRL + C to terminate the kernel. It might be easier just to open it with Method 1.