Tag: ubuntu

RDP on Ubuntu 18.04

Install RDP on Ubuntu 18.04

sudo apt-get install xrdp xorgxrdp xrdp-pulseaudio-installer

Then restart the computer.

Should be able to connect to the RDP server using a Microsoft Remote Desktop Client now.

Note: RDP is not secure.  RDP will need a SSH tunnel if you want a secure environment.

Open a SSH Tunnel to the RDP Server
ssh -L [local port]:[target server address from ssh server]:[target server port] [remote username]@[remote ssh server]
In my case the XRDP server is the same as the SSH server which is
ssh -L [local port]:[xrdp hostname]:[xrdp port] [remote username]@[remote ssh server]
ssh -L 3389:localhost:3389 user@rdpserver

In your RDP client connect to localhost.  Since we are using the default port of 3389 it should not need to be specified.

http://colhountech-linux.northeurope.cloudapp.azure.com/how-to-_securely_-access-linux-ubuntu-over-rdp/
https://www.howtogeek.com/168145/how-to-use-ssh-tunneling/
https://blog.shichao.io/2015/01/06/tunneling_rdp_over_ssh_with_xrdp_and_xfreerdp.html

Bug
Source: http://catch22cats.blogspot.com/2018/05/xrdp-creates-strange-directory-called.html
You may notice a thinclient_drive in your directory.  This seems to be a bug in xrdp code which attempts to share drives, clipboard and other things. It is creating this directory and not mounting it correctly. Here is how to get rid of it.
edit /etc/xrdp/xrdp.ini
Update the allow_channels setting to say allow_channels=false
After saving the change, remove the spurious thinclient_drives directory. If the system will not allow you to remove it, first unmount it with
sudo umount $HOME/thinclient_drives

You will not be able to use shared drives, clipboard, and so on, but those do not seem to be working anyway.

Ubuntu Missing Restart Option in Unity

Ubuntu 16.04, Unity doesn’t have a logout and restart option in the menu, just shutdown (which actually just logs out).  Here’s how to fix that.  Original Source.

Type the following into the command line.  Note the trailing slash is important.

dconf reset -f "/home/yourusername/"

fixubuntu.com

From https://fixubuntu.com/
This is totally a copy of the link above, all credit goes to fixubuntu.com, I’m merely putting it here for my own keepings.  This is applicable for ubuntu 13.04+

Copy and Paste in Terminal

gsettings set com.canonical.Unity.Lenses remote-content-search none; if [ `cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d”=” -f2` \> /etc/hosts’;

What it does:

settings set com.canonical.Unity.Lenses remote-content-search none Turns off “Remote Search”, so search terms in Dash don’t get sent to the internet
gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']" Turns off other remote Dash scopes, just in case (for Ubuntu 13.10 and newer)
sudo apt-get remove -y unity-lens-shopping Uninstalls Amazon ads built-in to Ubuntu (for Ubuntu 13.04 and older)
sudo sh -c 'echo "127.0.0.1 productsearch.ubuntu.com" >> /etc/hosts' Blocks connections to Ubuntu’s ad server, just in case

Ubuntu 10.04 on a T60 – flickering and wifi dropping

Ubuntu 10.04 runs pretty bad out of the box on a Thinkpad T60. There was a lot of random screen flickering and the wifi connection would drop under heavy load. One way to make the wifi drop happen was to start watching a full episode of the daily show and then start copying a file over your network to your computer.

Thinkpad T60
ATI Radeon x1400
iwl3945

It seems the screen flickering has to do with the ATI drivers, which are really poor in linux. Surprisingly the wifi problems are related.
I found a post on the ubuntu forums detailing the fix. The fix is to turn off the kernal mode settings (KMS ). To do this edit your /etc/default/grub file and edit the contents:
sudo vi /etc/default/grub

# ORIGINAL: GRUB_CMDLINE_LINUX=””
GRUB_CMDLINE_LINUX=”nomodeset”

Follow this up with a sudo update-grub and reboot.
Also from the same thread it mentions you can also set kernal parameter radeon.modeset=0. I choose nomodeset, the option above which as worked for me.

Either nomodeset or more specific radeon.modeset=0 kernel parameter made it as responsive as 9.10 and fixed suspend and hibernate.

I also replaced NetworkManager with Wicd and am very pleased with it.
ATI Pink Flicker Bugs
Wifi Drop Bugs

Encrypting a directory with Ubuntu

I found a nice post on the ubuntu forums on how to encrypt a directory in Ubuntu. This is a copy and paste of that post by remmelt, I cannot take credit for it.
This guide describes how to create encrypted directories. These can come in handy for laptop users, password lists and the like.

1. Install the software
Code:

sudo apt-get install encfs fuse-utils
sudo modprobe fuse

And since we don’t want to modprobe each time we reboot, add “fuse” to /etc/modules (without quotes, on a line of its own)

2. Add yourself to the fuse group
The installer creates a fuse group and to use fusermount you need to be in this group. You can do this with your favourite GUI admin tool or command line:
Code:

sudo adduser fuse

3. Create a directory where your encrypted stuff will be stored
I put mine in my home dir, but you can put it anywhere you like.
Code:

mkdir ~/encrypted

4. Create a mountpoint
This is the directory where you will mount the encrypted directory. Through this path you can access the encrypted files.
Code:

mkdir ~/temp_encr

5. Create the encrypted system and mount it
The first time you try to mount the directory, encfs will create the encrypted filesystem. It works like the regular mount:
Code:

encfs

So for this example:
Code:

encfs /home//encrypted /home//temp_encr

Note that encfs wants absolute paths, i.e. starting with a /

6. Do the work
Put some files in your ~/temp_encr folder and look in the ~/encrypted one: they will show up there, encrypted.

7. Unmount the encrypted filesystem
Unmounting is as easy as
Code:

fusermount -u /home//temp_encr

8. Goto step 5
Repeat! EncFS will only create the filesystem once, after that first time it will ask for a password and mount your directory.

Remember to keep the two directories apart: in this example the “encrypted” folder holds your encrypted data and should not be used directly. The gateway to access this data is “temp_encr” or whatever you want to call it.

This was tested and verified on Ubuntu 10.04

Simple Way to Record TV with Ubuntu

Taken from this post.

This is how I record TV without installing mythtv.

1. Get mencoder

Code:


sudo apt-get install mencoder

2. Create the script (record.sh):
Code:


#!/bin/sh

# Duration of recording (in seconds)
DURATION=$1

CHANNEL=$2

# Filename (excluding extension)
FILE=$3\.avi

# Record from tv
mencoder tv:// -tv driver=v4l2:device=/dev/video0:channel=$CHANNEL:forceaudio:norm=NTSC-M:chanlist=us-cable:alsa:adevice=hw.0,0:immediatemode=0 \
-ovc xvid -xvidencopts bitrate=800 \
-oac pcm \
-endpos $DURATION -sws 1 -o $FILE

3. Make the script executable and run it:

Code:

chmod u+x record.sh
./record.sh 3600 3 heroes

Another script from here:


#!/bin/bash

if [ $# -ne 3 ]
then
echo "Usage: $0 channel seconds filename"
exit
fi

WIDTH=640
HEIGHT=480
MENCODER=/usr/bin/mencoder
AUDIO="-oac mp3lame -lameopts cbr:br=128:mode=3"
VIDEO="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=6400"
DSP="adevice=/dev/dsp"
TV=" -tv driver=v4l2:width=$WIDTH:height=$HEIGHT:outfmt=yuy2:input=0:device=/dev/v4l/video0:norm=NTSC:chanlist=us-cable:channel=$1:$DSP"
$MENCODER tv:// $TV $VIDEO $AUDIO -endpos $2 -ffourcc divx -o "$3.avi"

View DVDs with Ubuntu

Ubuntu can’t watch DVDs out of the box. To do so you need to install lidbdvdcss from medibuntu. Do the following:

sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get -q update
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
sudo apt-get -q update
sudo apt-get install libdvdcss2

side note, if you wish to install support for wmv and realmedia do the following
i386:
sudo apt-get install w32codecs

amd64:
sudo apt-get install w64codecs