---
title: finished - Linux Tricks
description: 
published: 1
date: 2024-02-04T09:12:01.118Z
tags: 
editor: markdown
dateCreated: 2024-02-01T23:17:04.906Z
---

    @page { size: 8.5in 11in; margin: 0.79in } p { line-height: 115%; margin-bottom: 0.1in; background: transparent } pre { background: transparent } pre.western { font-family: "Liberation Mono", monospace; font-size: 10pt } pre.cjk { font-family: "Noto Sans Mono CJK SC", monospace; font-size: 10pt } pre.ctl { font-family: "Liberation Mono", monospace; font-size: 10pt } h1 { margin-bottom: 0.08in; background: transparent; page-break-after: avoid } h1.western { font-family: "Liberation Sans", sans-serif; font-size: 18pt; font-weight: bold } h1.cjk { font-family: "Noto Sans CJK SC"; font-size: 18pt; font-weight: bold } h1.ctl { font-family: "Lohit Devanagari"; font-size: 18pt; font-weight: bold } h2 { margin-top: 0.14in; margin-bottom: 0.08in; background: transparent; page-break-after: avoid } h2.western { font-family: "Liberation Sans", sans-serif; font-size: 16pt; font-weight: bold } h2.cjk { font-family: "Noto Sans CJK SC"; font-size: 16pt; font-weight: bold } h2.ctl { font-family: "Lohit Devanagari"; font-size: 16pt; font-weight: bold } a:link { color: #000080; so-language: zxx; text-decoration: underline } code.western { font-family: "Liberation Mono", monospace } code.cjk { font-family: "Noto Sans Mono CJK SC", monospace } code.ctl { font-family: "Liberation Mono", monospace } kbd.western { font-family: "Liberation Mono", monospace } kbd.cjk { font-family: "Noto Sans Mono CJK SC", monospace } kbd.ctl { font-family: "Liberation Mono", monospace } strong { font-weight: bold }

  

test

  

Clear snap folder: /var/lib/snapd/snaps

[https://askubuntu.com/questions/1000177/is-the-snap-core-folder-needed](https://askubuntu.com/questions/1000177/is-the-snap-core-folder-needed)

`sudo apt purge snapd ubuntu-core-launcher squashfs-tools`

  

  

[https://unix.stackexchange.com/questions/130786/can-i-remove-files-in-var-log-journal-and-var-cache-abrt-di-usr](https://unix.stackexchange.com/questions/130786/can-i-remove-files-in-var-log-journal-and-var-cache-abrt-di-usr)

```
$ journalctl --disk-usage
```

  

  

D3 with Python in Jupyter:

[https://livingwithmachines.ac.uk/d3-javascript-visualisation-in-a-python-jupyter-notebook/](https://livingwithmachines.ac.uk/d3-javascript-visualisation-in-a-python-jupyter-notebook/)

[https://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/quickstart/quickstart.ipynb](https://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/quickstart/quickstart.ipynb)

  

  

  

  

  

  

  
<br></br>
# Install equalizer on Ubuntu 20.04

[https://ubuntu-mate.community/t/equalizer-for-ubuntu-20-04-lts/22218](https://ubuntu-mate.community/t/equalizer-for-ubuntu-20-04-lts/22218)

`sudo apt install -y pulseeffects lsp-plugins`

  

  

  

  

  

  

# Execute JNLP files in Linux

[https://linux-tips.com/t/execute-jnlp-files-in-linux/252](https://linux-tips.com/t/execute-jnlp-files-in-linux/252)

  
  

$ sudo apt-get install icedtea-netx

$ sudo apt-get install icedtea-plugin

$ javaws filename.jnlp

  

  

# Take Screenshot

Druck

Shift + druck for selecting area

  
  

  
  

  
  

# Install writer2latex in Ubuntu

$ sudo apt update

$ sudo apt install writer2latex

  
  

[http://writer2latex.sourceforge.net/index15.html](http://writer2latex.sourceforge.net/index15.html)

Specific instructions for Ubuntu: To install Java and Java support in LibreOffice, open a terminal window and type

$ sudo apt-get install default-jre

$ sudo apt-get install libreoffice-java-common

  
  

  
  

[https://superuser.com/questions/1192004/why-unable-to-install-writer2latex-1-4-on-ubuntu](https://superuser.com/questions/1192004/why-unable-to-install-writer2latex-1-4-on-ubuntu)

try in command line

$ sudo apt-get insall libreoffice-writer2latex

if not working install java if not already installed

$ sudo apt-get install default-jre

  
  

  
  

  
  

# Latex topics in Ubuntu

  
  

\\usepackage{hyperref}

File \`pdftexcmds.sty' not found.

tlmgr install pdftexcmds

  
  

[https://tex.stackexchange.com/questions/73016/how-do-i-install-an-individual-package-on-a-linux-system](https://tex.stackexchange.com/questions/73016/how-do-i-install-an-individual-package-on-a-linux-system)

$ which tlmgr

→/usr/bin/tlmgr

$ sudo /usr/bin/tlmgr install pdftexcmds

  
  

Issue: “tlmgr: user mode not initialized, please read the documentation!”

[https://tex.stackexchange.com/questions/137428/tlmgr-cannot-setup-tlpdb](https://tex.stackexchange.com/questions/137428/tlmgr-cannot-setup-tlpdb)

$ tlmgr init-usertree

  
  

  
  

  
  

[https://tex.stackexchange.com/questions/158700/latex-cant-find-sty-files-altough-packages-are-installed-texlive-ubuntu-12?rq=1](https://tex.stackexchange.com/questions/158700/latex-cant-find-sty-files-altough-packages-are-installed-texlive-ubuntu-12?rq=1)

$ locate caption.sty

  
  

  
  

# Latex export with writer2latex (v1.6.1)

-   `By 	using the following settings, a .tex file could be exported, but 	there were issues using \usepackage{hyperref} and 	\usepackage[pdftex]{``graphicx``} 	==> these commands in the preamble had to be commented out or 	replaced by \usepackage{``graphicx``}`
    

![](Linux_tricks_2_html_a0fd7fb6fff0adcc.png)

![linux_tricks_2_html_a0fd7fb6fff0adcc.png](/pictures/linux_tricks_2_html_a0fd7fb6fff0adcc.png)
  

  

  

  

# interactive mode with Juptyer Notebooks

Issue: 

@interact and @interactive decorators did not update figures/etc.

  

Solution (not working):

[https://stackoverflow.com/questions/36351109/ipython-notebook-ipywidgets-does-not-show](https://stackoverflow.com/questions/36351109/ipython-notebook-ipywidgets-does-not-show)

$ pip install ipywidgets

$ jupyter nbextension enable --py widgetsnbextension

  

  

  

  

  

  

  

  

  

  

  

  

  

  

# Using Ctrl+V to paste unformatted text by default

[https://superuser.com/questions/73450/using-ctrlv-to-paste-unformatted-text-by-default-in-openoffice-orgs-calc](https://superuser.com/questions/73450/using-ctrlv-to-paste-unformatted-text-by-default-in-openoffice-orgs-calc)

You can also just switch the assigned keys from Paste to Paste Unformatted, and from Paste Unformatted to Paste. I've done this in version 6.4. I haven't tested the idea in Calc or any other module.

What you want to do is change the keystrokes that are associated with the “Paste Unformatted” and “Paste” commands. You do this using the Keyboard Customization tool.

Start by choosing Tools –> Customize. When the dialog box appears, select the “Keyboard” tab.  A dialog box containing 4 panels and some control buttons appears.  The top panel contains a list of every key the system allows modifying along with the command that key performs.  For example, pressing <kbd class="western">F2</kbd> starts a formula expression; <kbd class="western">F11</kbd> invokes the styles panel.

_[![Keyboard Customization Dialog Box](Linux_tricks_2_html_19ebb791d64bdfba.png)](https://i.stack.imgur.com/9RpcX.png)_
![linux_tricks_2_html_19ebb791d64bdfba.png](/pictures/linux_tricks_2_html_19ebb791d64bdfba.png)

In the ****Category**** panel, lower left corner, scroll down and highlight the ****Edit**** Category.

In the ****Function**** Panel, scroll down, and highlight ****Paste****. The ****Keys**** panel displays "Ctrl+Shift+V". Highlight that keystroke and click the ****Delete**** button (upper right). Leave this Function unassigned for the moment.

Now highlight the ****Paste Unformatted Text**** item in the ****Function**** box. The Keys panel will display "Ctrl+V". Click ****Delete**** for this key. Now neither function has a keystroke associated with it.

To associate Ctrl+Shift+V with the ****Paste Unformatted Text**** Function, go to the Shortcut Keys panel and highlight the ****Ctrl+Shift+V**** option. Click the ****Modify**** button. "Ctrl+Shift+V" now appears in the ****Keys**** panel on the lower left.

Go back to the ****Paste**** option in the ****Function**** panel. Find "Ctrl+V" in the top ****Shortcut Keys**** panel, highlight it and press the ****Modify**** button on the right. "Ctrl+V" appears in the ****Keys**** panel on the lower left.

Click ****OK****. Your two paste functions are now associated with the keystrokes in the way you want them.

  

  
  

  
  

  
  

# lAdd repository and install from this source

## Lutris (games for Linux)

[https://lutris.net/downloads/](https://lutris.net/downloads/)

$ sudo add-apt-repository ppa:lutris-team/lutris

$ sudo apt update

$ sudo apt install lutris

  
  

install Epic Games Store from: [https://lutris.net/games/epic-games-store/](https://lutris.net/games/epic-games-store/)

  
  

Install game on Windows, but run it with Lutris & share savegames:

[https://www.reddit.com/r/linux\_gaming/comments/k0qxcj/is\_it\_possible\_to\_use\_lutris\_for\_installed\_games/](https://www.reddit.com/r/linux_gaming/comments/k0qxcj/is_it_possible_to_use_lutris_for_installed_games/)

so the comamnd would look like thsi if you're inside the wineprefix in the above location:

ls -s ./ /windows/c/Users/You-Handsome-Guy/AppData/MyGames/My-Awesome-Game-Saves/

This way you should be able to play the game with shared save game on both systems just fine without making them interfering with each other except of the actual game files.

  
  

Problem with missing fonts on UI buttons in Rimworld:

[https://www.reddit.com/r/RimWorld/comments/oo9hbo/missing\_fonts/](https://www.reddit.com/r/RimWorld/comments/oo9hbo/missing_fonts/)

solved by installing Arial fonts via winetricks

  
  

where to find wine savegames, e.g. for RimWorld:

/home/bora/.wine/drive\_c/users/bora/AppData/LocalLow/Ludeon Studios/RimWorld by Ludeon Studios

  
  

## **Install Steam on Ubuntu**

[https://itsfoss.com/install-steam-ubuntu-linux/](https://itsfoss.com/install-steam-ubuntu-linux/)

sudo apt install steam-installer

  
  

  
  

  
  

# **Clear Spotify cache**

[https://superuser.com/questions/649208/clearing-spotify-cache-to-recover-disk-space](https://superuser.com/questions/649208/clearing-spotify-cache-to-recover-disk-space)

By default, Spotify limits its cache to 10% of your free space, which means the default setting should be okay—but if you've changed it, you could run into disk space problems. All you need to do is delete the files in the following folder (for your platform):

Windows: C:\\Users\\USERNAME\\AppData\\Local\\Spotify\\Storage

OS X: /Users/USERNAME/Library/Caches/com.spotify.client/Storage/

Linux: ~/.cache/spotify/Storage/

  
  

Installed with Snap on Ubuntu this config file for me was found at ~/snap/spotify/current/.config/spotify/prefs

  
  

Add or modify the line starting with storage.size to the number of megabytes you want the cache to use. For example:

storage.size=512

  
  

  
  

# activate standby mode for hdd on RaspberryPi

[https://medium.com/@tamashudak/spin-down-hdd-with-raspberry-pi-using-hd-idle-7709e6c921f8](https://medium.com/@tamashudak/spin-down-hdd-with-raspberry-pi-using-hd-idle-7709e6c921f8)

[https://maker-tutorials.com/raspberry-pi-festplatte-automatisch-standby-hdparm/](https://maker-tutorials.com/raspberry-pi-festplatte-automatisch-standby-hdparm/)

[https://ittweak.de/raspberry-pi-usb-fesplatte-in-standby-ruhemodus-idle-setzen/](https://ittweak.de/raspberry-pi-usb-fesplatte-in-standby-ruhemodus-idle-setzen/)

[https://superuser.com/questions/937480/does-the-raspberry-pi-2-put-usb-external-drives-to-sleep-when-not-in-use-for-a-w](https://superuser.com/questions/937480/does-the-raspberry-pi-2-put-usb-external-drives-to-sleep-when-not-in-use-for-a-w)

  
  

  
  

# Install Tor browser

[https://linuxize.com/post/how-to-install-tor-browser-on-ubuntu-20-04/](https://linuxize.com/post/how-to-install-tor-browser-on-ubuntu-20-04/)

Add the Tor browser launcher PPA repository :

$ sudo add-apt-repository ppa:micahflee/ppa

Install the Tor browser launcher package:

$ sudo apt update

$ sudo apt install torbrowser-launcher

  
  

The Tor browser can be launched either from the command line by typing **torbrowser-launcher** or by clicking on the Tor Browser Launcher icon (Activities -> Tor Browser).

  
  

If you want to uninstall the Tor browser, remove the installed package with the following command:

$ sudo apt remove torbrowser-launcher

  
  

## specify exit node:

[https://www.wikihow.com/Set-a-Specific-Country-in-a-Tor-Browser](https://www.wikihow.com/Set-a-Specific-Country-in-a-Tor-Browser)

[https://tor.stackexchange.com/questions/733/can-i-exit-from-a-specific-country-or-node](https://tor.stackexchange.com/questions/733/can-i-exit-from-a-specific-country-or-node)

  
  

need to edit torrc file located in following folder:

/home/bora/.local/share/torbrowser/tbb/x86\_64/tor-browser\_en-US/Browser/TorBrowser/Data/Tor

  
  

add following line into file if not existing yet:

ExitNodes {TR}

  
  

# Write Linux image onto USB drive

## Using balena etcher and link to image:

Ubuntu mirrors: [https://launchpad.net/ubuntu/+cdmirrors](https://launchpad.net/ubuntu/+cdmirrors)

-   copy link to one of the iso image, e.g. [https://ftp-stud.hs-esslingen.de/pub/Mirrors/releases.ubuntu.com/21.10/ubuntu-21.10-desktop-amd64.iso](https://ftp-stud.hs-esslingen.de/pub/Mirrors/releases.ubuntu.com/21.10/ubuntu-21.10-desktop-amd64.iso)
    
-   paste link into balena GUI →
    

advantage of providing only link to iso and not download the image is that nothing has to be saved on the PC

  
  

  
  

# Install and Uninstall software on Ubuntu

## Kicad

Quick installation of kicad:

$ sudo apt-get update

$ sudo apt-get install kicad

  
  

[https://www.thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/kicad?type=uninstall](https://www.thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/kicad?type=uninstall)

$ sudo apt-get remove kicad

Uninstall kicad including dependent package: $ sudo apt-get remove --auto-remove kicad

If you use with purge options to kicad package all the configuration and dependent packages will be removed: $ sudo apt-get purge kicad

If you use purge options along with auto remove, will be removed everything regarding the package, It's really useful when you want to reinstall again: $ sudo apt-get purge --auto-remove kicad

  
  

  
  

# Blender

[https://docs.blender.org/manual/en/latest/getting\_started/installing/linux.html](https://docs.blender.org/manual/en/latest/getting_started/installing/linux.html)

Install from Snap

$ snap install blender

  
  

  
  

  
  

# Use YubiKey

## Installation of yubikey manager

[https://support.yubico.com/hc/en-us/articles/360016649039-Enabling-the-Yubico-PPA-on-Ubuntu](https://support.yubico.com/hc/en-us/articles/360016649039-Enabling-the-Yubico-PPA-on-Ubuntu)

sudo add-apt-repository ppa:yubico/stable && sudo apt-get update

YubiKey Manager (CLI): sudo apt install yubikey-manager

YubiKey Personalization Tool: sudo apt install yubikey-personalization-gui

libpam-yubico: sudo apt install libpam-yubico

libpam-u2f: sudo apt install libpam-u2f

  
  

alternatively: run the YubiKey manager AppImage!

  
  

  
  

## Touch triggered OTP

[https://developers.yubico.com/Developer\_Program/Guides/Touch\_triggered\_OTP.html](https://developers.yubico.com/Developer_Program/Guides/Touch_triggered_OTP.html)

  
  

  
  

Authentication with Mobile Platforms

[https://developers.yubico.com/Mobile/](https://developers.yubico.com/Mobile/)

  
  

Applications supporting YubiKeys

[https://www.yubico.com/de/works-with-yubikey/catalog/?sort=popular](https://www.yubico.com/de/works-with-yubikey/catalog/?sort=popular)

  
  

Ubuntu Linux Login Guide – U2F

[https://support.yubico.com/hc/en-us/articles/360016649099-Ubuntu-Linux-Login-Guide-U2F](https://support.yubico.com/hc/en-us/articles/360016649099-Ubuntu-Linux-Login-Guide-U2F)

  
  

  
  

Secure Windows with strong authentication

[https://www.yubico.com/products/computer-login-tools/](https://www.yubico.com/products/computer-login-tools/)

  
  

Yubico Login for Windows Configuration Guide

[https://support.yubico.com/hc/en-us/articles/360013708460-Yubico-Login-for-Windows-Configuration-Guide](https://support.yubico.com/hc/en-us/articles/360013708460-Yubico-Login-for-Windows-Configuration-Guide)

  
  

Associating the YubiKey with Websites (Services)

[https://support.yubico.com/hc/en-us/articles/360013778879-Associating-the-YubiKey-with-Websites-Services-](https://support.yubico.com/hc/en-us/articles/360013778879-Associating-the-YubiKey-with-Websites-Services-)

  
  

  
  

Yubico Authenticator

[https://www.yubico.com/products/yubico-authenticator/](https://www.yubico.com/products/yubico-authenticator/)

  
  

  
  

  
  

How to register your spare key

[https://support.yubico.com/hc/en-us/articles/360021919459-How-to-register-your-spare-key-](https://support.yubico.com/hc/en-us/articles/360021919459-How-to-register-your-spare-key-)

  
  

Using Your YubiKey with Authenticator Codes

[https://support.yubico.com/hc/en-us/articles/360013789259-Using-Your-YubiKey-with-Authenticator-Codes](https://support.yubico.com/hc/en-us/articles/360013789259-Using-Your-YubiKey-with-Authenticator-Codes)

  
  

Understanding YubiKey PINs

[https://support.yubico.com/hc/en-us/articles/4402836718866-Understanding-YubiKey-PINs](https://support.yubico.com/hc/en-us/articles/4402836718866-Understanding-YubiKey-PINs)

  
  

Basic YubiKey Troubleshooting

[https://support.yubico.com/hc/en-us/articles/360013707540-Basic-YubiKey-Troubleshooting](https://support.yubico.com/hc/en-us/articles/360013707540-Basic-YubiKey-Troubleshooting)

  
  

  
  

Using Your YubiKey with KeePass

[https://support.yubico.com/hc/en-us/articles/360013779759-Using-Your-YubiKey-with-KeePass](https://support.yubico.com/hc/en-us/articles/360013779759-Using-Your-YubiKey-with-KeePass)

4d24a4ae6c32c56060d1f52d76f47aade44f885f

  
  

KeeChallenge (A plugin for KeePass2 to add Yubikey challenge-response capability.)

[https://richardbenjaminrush.com/keechallenge/](https://richardbenjaminrush.com/keechallenge/)

  
  

  
  

  
  

  
  

  
  

# How to run an AppImage

[https://appimage.org/](https://appimage.org/)

Make it executable

$ chmod a+x Subsurface\*.AppImage

  
  

and run!

$ ./Subsurface\*.AppImage

  
  

  
  

  
  

# Install KeePass

[https://keepass.info/download.html](https://keepass.info/download.html)

[https://sourceforge.net/p/keepass/discussion/329220/thread/17d1bd26/](https://sourceforge.net/p/keepass/discussion/329220/thread/17d1bd26/)

sudo apt-add-repository ppa:jtaylor/keepass

sudo apt-get update

sudo apt-get install keepass2

  
  

  
  

  
  

# Get root access for copying files to /usr/share/...?

[https://askubuntu.com/questions/10435/get-root-access-for-copying-files-to-usr-share](https://askubuntu.com/questions/10435/get-root-access-for-copying-files-to-usr-share)

/usr/ is owned by the root account so to write files in there you need to write them as root. Two methods (there are undoubtedly more but here are the two main ways for most users):

  
  

1.  Press Alt+F2 to get a run dialogue and in that type gksu nautilus. This will open up a file browser window running as root. Copy your files across but be careful, you can nuke the system like this.
    
2.  A much more direct method is just loading up a terminal and writing:  
    sudo cp -R /path/to/files/you/want/copied/ /copy/to/this/path/  
    (the -R is just there to recursively copy directories)
    

  
  

If you ever want to fire off multiple commands as root without prepending them all with sudo you can run sudo -i or sudo su and you'll get a root terminal. But again, be careful what you do.

  
  

  
  

OR:

sudo gnome-terminal

  
  

  
  

OR:

[https://www.how2shout.com/linux/open-ubuntu-file-manager-as-root-user/](https://www.how2shout.com/linux/open-ubuntu-file-manager-as-root-user/)

sudo nautilus




# mounting fritz.nas folder for referecing in Python scripts on Ubuntu


# Procedure 1
https://unix.stackexchange.com/questions/608044/how-to-mount-a-folder-from-a-nas-drive-in-ubuntu

https://unix.stackexchange.com/questions/99065/how-to-mount-a-windows-samba-windows-share-under-linux

Install support packages: smbclient and cif-utils:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo apt-get install smbclient
sudo apt-get install cifs-utils
```

Create target directory to mount remote share:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo mkdir -p /mnt/my_mount_dir
```

Mount remote folder:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo mount -t cifs -o "domain=MYDOMAIN,username=MyUserName,password=myPas$werd,sec=ntlm" //(your windows host ip)/(your remote share name) /mnt/my_mount_dir
```

UPDATE: After updating my local install of Debian to version 6.3, my mount command broke requiring me to add the vers option to specify SMB1:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo mount -t cifs -o "domain=MYDOMAIN,username=MyUserName,password=myPas$werd,sec=ntlm,vers=1.0" //(your windows host ip)/(your remote share name) /mnt/my_mount_dir
```


sudo mkdir -p /mnt/FRITZNAS

sudo mount -t cifs -o "domain=WORKGROUP,username=Bora,password=thisismyfritzbox90,sec=ntlm,vers=1.0" smb://fritz.nas/fritz.nas/ /mnt/FRITZNAS



## Procedure 2
https://www.andwil.de/weblog/linux-fritznas-mounten-cifs

Es müssen SAMBA und CIFS über die Paketverwaltung installiert werden. Ersteres ermöglicht überhaupt erst den Zugriff auf den FritzNAS, Zweiteres wird zum Einbinden aus dem Terminal heraus benötigt. Unter Debian und Ubuntu sieht die Installation beispielsweise so aus:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo apt install samba cifs-utils
```

Lege im Home-Verzeichnis eine Datei mit dem Namen .smbcredentials an, z.B. mit dem Befehl `nano ~/.smbcredentials`. Sie enthält den FritzNAS-Benutzernamen und das zugehörige Passwort und ist folgendermaßen aufgebaut:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
username=Bora
password=thisismyfritzbox90
```

Das hat den Charme, dass man beim Einbinden sein Passwort nicht jedes Mal im Klartext in die Konsole tippen muss.

Lege ein Verzeichnis an, in dem der NAS-Speicher später auftauchen soll, z.B. mit dem Befehl `mkdir ~/fritzNAS` oder über deinen grafischen Datei-Manager.



### 2.2.1  Temporär einbinden
Soll der FritzNAS nur einmalig eingebunden werden oder die Konfiguration getestet werden, kann dieser Befehl genutzt werden:

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo mount -t cifs -o credentials=$HOME/.smbcredentials,vers=3.0,noserverino //192.168.178.1/FRITZ.NAS/ /mnt/
```
``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
sudo mount -t cifs -o credentials=$HOME/.smbcredentials,vers=3.0,noserverino //192.168.178.1/FRITZ.NAS/ /mnt/FRITZNAS
```


Hier kommen deine Konfigurationen von oben zum Tragen! Verwende die in Schritt 5 ermittelte IP-Adresse sowie die FritzNAS-Bezeichnung aus Schritt 3. Wenn du die Standard-Werte beibehalten hast, kannst du obigen Befehl 1:1 ins Terminal kopieren.

Alte FritzBoxen (Fritz!OS-Versionen bis einschließlich 6.x) verwenden eine veraltete Samba-Protokollversion. Das NAS kann trotzdem noch eingebunden werden, schreibe hierfür statt vers=3.0 einfach vers=1.0.
Die Dateien auf dem NAS können dann unter /mnt/ eingesehen werden. Alternativ kann natürlich auch ein anderes Verzeichnis angegeben werden.


### 2.2.2  Permanent einbinden
Soll der FritzNAS dagegen automatisch bei jedem Systemstart eingebunden werden, muss die Datei /etc/fstab mit Root-Rechten bearbeitet werden. Beachte, dass dein Rechner in diesem Fall per Ethernet-Kabel am Netzwerk hängen sollte, damit beim Boot-Vorgang bereits eine Netzwerkverbindung besteht.

Wenn du mal per WiFi online bist, auch nicht schlimm: Der Rechner fährt trotzdem normal hoch. Sobald du mit dem WLAN verbunden bist, starte den Befehl sudo mount -a manuell, um den FritzNAS einzubinden.


Lege zunächst ein Backup der fstab an:

$ sudo cp /etc/fstab{,~NAS.bak}

Jetzt führe den Befehl

$ sudoedit /etc/fstab

aus und ergänze folgende Zeile (beachte auch den darauffolgenden Kasten!):

``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
(…)
//192.168.178.1/FRITZ.NAS/ /home/{DeinBenutzername}/fritzNAS cifs credentials=/home/{DeinBenutzername}/.smbcredentials,vers=3.0,noserverino,uid=1000,gid=1000,x-systemd.automount,x-systemd.requires=network-online.target 0 0
```

  
Auch hier müssen wieder folgende Parameter bei Bedarf angepasst werden:
- die IP-Adresse der FritzBox (siehe Schritt 5, default: 192.168.178.1)
- der Name des NAS (Schritt 3, default: FRITZ.NAS)
- der absolute Pfad zum Zielverzeichnis, der in Schritt 8 angelegt wurde –Abkürzungen wie ~/ oder $HOME funktionieren hier nicht
- der absolute Pfad zur .smbcredentials
- Wenn auf deinem Rechner mehrere Benutzerkonten angelegt sind, müssen die Werte für uid und gid ggf. angepasst werden, damit du Lese- und Schreibzugriff auf das Verzeichnis bekommst. Du erfährst diese Werte mit dem Befehl id, so in etwa sieht die Ausgabe dann aus:
``` {.western style="line-height: 160%; orphans: 2; widows: 2; border: none; padding: 0in; background: #f9f9f9"}
andwil@denkbrett:~$ id andwil [↵]
uid=1000(andwil) gid=1000(andwil) Gruppen=1000(andwil),4(adm),…
```

Teste die Konfiguration mit dem Befehl `sudo mount -a`. Das ist bequemer, als bei jeder Anpassung der fstab den Rechner neuzustarten. Wenn es unlösbare Probleme geben sollte, spiele einfach das Backup wieder ein – so kannst du nichts kaputt spielen.











