Mount a SFTP connection to a folder in Ubuntu / Linux

To do this I used a program called SSHFS which has done a great job. First, install if from the repo

sudo apt-get install sshfs

You’ll need to create a directory to use as the location for your files

sudo mkdir /mnt/sshftps

Execute the command to connect the actual SFTP Server. Replace xxx.xxx with the target IP address and use the -p option to specify the connection port. The user parameter is your user name. The :/ at the end of the IP address indicates the end of the IP address. Don’t try to put the port number after the colon

sudo sshfs -o allow_other -p 6789 user@xxx.xx.xxx.xx:/ /mnt/sshftps

This will create a semi-permanent connection which will close if the machine is restarted. You can create a permanent connection which will reopen when the machine starts by editing the fstab file in /etc/fstab. Add a command to the end and restart the machine. Personally, I haven’t tried this because it’s a potential security risk and I didn’t need 100% uptime.

sshfs#username@xxx.xxx.xxx.xxx:/ /mnt/sshftp

Plex Running on Ubuntu / Linux / Lubuntu Doesn’t Display My External Drive

When moving all my files onto an external drive Plex was able to display the drive but was unable to read the content of the folder.

Changing group ownership and permissions did not solve this problem.
The drive was formatted with NTFS before being installing it in a housing and connected to the Linux machine.

The problem is caused by the default mounting parameters when first connecting the drive. In order to fix it you will need to manually setup the drive by editing the fstab file. Use this command

sudo blkid

This will get you the drive UUID of the drive that you need. Look at the labels until one of them looks familiar. You can also use the built in disk utility to get this number. System > Disks > “Gear Icon” > Edit Mount Options but it’s harder than just doing it in the terminal.

Create a folder to use as the path for your drive. I used /media/Videos since that’s what I would be storing.

sudo mkdir /media/Videos

Open the fstab file and add this line to the end using the UUID that you just found.

sudo gedit /etc/fstab
UUID=E12345A1234C1A12345 /media/Videos ntfs-3g defaults,permissions,auto 0 1

It’s easiest just to restart your computer to get these changes applied. You could also unmount the drive and then run the mount command which will pick up the new settings from the fstab file. If you have trouble with this just reboot

sudo mount /media/Videos

Without doing the next couple of steps I didn’t consistently have problems but I did have problems with permissions and file transfer being denied

cd /etc/samba
sudo gedit smb.conf

Scroll to the bottom and add into the section that was just created with the name of your share [videos] in this case

force user = yourUserName

And then restart Samba

sudo restart smbd

This other post helped me get up and running if you want another take on the same process.
http://travelinlibrarian.info/2013/05/how-to-share-an-external-usb-hard-drive-from-ubuntu-to-a-windows-network/

Handy Linux Commands

Get the size of the folders in any directory

du -sh folder_location/*

Get the size of folders in the current directory

sudo du -chax --max-depth=1 . | grep -E "M|G"

Search for content of a file from the command line

grep [--include=file_pattern.extension] -rnwl "matching pattern"
http://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux

Create a new SVN Repo

sudo svnadmin create /svn/repos/repo_name
sudo chown -R www-data:www-data /svn/repos/repo_name

Remove Directory and Contents

rm -r mydir

List CPU Usage of running processes

top

Get Wireless Signal Information

iwconfig

will save in /tmp/file_list_$FOLDER an alphabetically ordered list of all the files inside $FOLDER, complete with the corresponding sub-folders

find $FOLDER -type f | cut -d/ -f2- | sort > /tmp/file_list_$FOLDER

Display all processes accessing a folder or drive (source)

sudo fuser -mv /folder

zpool change mount location (source)

zfs set mountpoint=/myspecialfolder mypool

lsof command to get the process ID of the process holding the lock files (source)

sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock

Get all processes running “apt” and kill those processes (source)

ps aux | grep -i apt
sudo kill -9 <process_id>

1and1 Cloud Hosting Odoo Install – Ubuntu 14.04

You can install Odoo from the Bitnami package but I wanted to have it from source so that I could make changes and get updates with the git commands.

I followed this guide to get started

https://www.linode.com/docs/websites/cms/install-odoo-9-erp-on-ubuntu-14-04

Which got me most of the way there but I still had 2 problems.


 

1 creating the database gave me an error

DataError: encoding UTF8 does not match locale en_US DETAIL: 
The chosen ****** setting requires encoding LATIN1.

To fix this I ran the following commands

sudo su postgres

psql

update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;

update pg_database set datistemplate=true where datname='template1';

 


 

Then once I had created my database I got an error at the top of the page

/usr/bin/env : node: No such file or directory in ovoo v9
– /website/static/src/less/import_bootstrap.less
– /web/static/src/less/variables.less
– /web/static/src/less/enterprise_compatibility.less
– /web/static/src/less/utils.less
– /web/static/src/less/modal.less
– /web/static/src/less/notification.less
– /base_import/static/src/less/import.less
– /web_tip/static/src/less/tip.less
– /web_calendar/static/src/less/web_calendar.less
– /web_diagram/static/src/less/diagram_view.less
– /web_kanban/static/src/less/kanban_dashboard.less
– /web_kanban/static/src/less/kanban_view.less
– /web_settings_dashboard/static/src/less/dashboard.less

To fix follow the instructions from the NodeJS Website:

curl -sL https://deb.nodesource.com/setup_0.10 | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g npm

Then install Less and accessories:

 sudo npm install -g less less-plugin-clean-css

The Simple Way to Mount a Network Drive on Lubuntu – Ubuntu – Debian

There are lots of answers out there for this problem and they are all absurdly complicated. Here’s the easy way to do it and it takes about 2 minutes.

If you don’t have cifs installed then you’ll need to install the utils package. It’s not installed by default with lubuntu. The command is “sudo apt-get install cifs-utils

Create a director to map this folder to in your media folder “sudo mkdir /media/{your folder name}

Then you need to edit your fstab file. “sudo leafpad /etc/fstab

To the end of the file add the following line; remember to replace the sections in brackets with your information
//{your drive IP address}/{any sub folders you want} /media/{your folder name} cifs username={drive_username},password={drive_password}

To test if it’s working type “sudo mount -a” if you did it wrong this will give you some useful error messages. Unfortunately cifs only supports IP addresses currently so you’re stuck with that. It’s generally a good idea to give things like a network drive a static IP address.

Earlier today I installed some updates and ended up having a problem with my mount. I had to add a version flag to the end of my fstab line to get it to work. vers=1.0 I tried vers=2.0 and vers=3.0 which did not work for me.
//192.168.1.1/volume /media/nas cifs username=****,password=****,vers=1.0