Mounting Network File Systems¶
Note
This guide describes connecting to either local or remote computer systems from Debian/Ubuntu/Mint desktops. Syntax will differ with other systems.
Server SSHFS Configuration¶
Install authentication and sharing modules on the remote server as follows:
sudo aptitude install openssh-server libpam-modules
The default host umask=0022 will shade permissions for files and folders created on the remote shares. Private home folders with umask=0077 will work just fine, but public folders needing umask=0007 will result in incorrect permissions which block write access. To prevent this problem:
sudoedit /etc/pam.d/sshd
Now add the following three lines:
# Default umask mask for SSH/SFTP sessions
# Shell sessions: Override with /etc/profile or ~/.bashrc or ~/.profile
session optional pam_umask.so umask=0000
As noted above, actual ssh shell logins on the remote host will get the default umask=022 on new files and directories. The following command will change this for all shell logins:
sudo sed -i s/umask 022/umask 0007/ /etc/profile
A logged in user could change just her own default umask with the command:
sudo sed -i s/#umask\ 022/umask\ 0007/ ~/.profile
References:
SSH Remote Consoles¶
A favorite Windows consultant expression is, “Just telnet into the server.” Telnet has been deprecated for a very long time in the Linux world. Instead, ssh provides encrypted communications for remote access over insecure channels such as the Internet. We recommend using the PuTTY utility to manage ssh sessions on all platforms.
Redirecting SSH to PuTTY¶
PuTTY is an open-source cross-platform client for secure ssh connections with remote hosts. It is available on Windows, Linux, and Mac, and it is the preferred client on Windows. PuTTY adds power to interactive sessions. For example, a user can add a port forwarding rule within a running terminal session.
For a KDE desktop system derived from Debian, the following console commands will redirect SSH to PuTTY (courtesy of VonGrippen, AKA Michael Cochran):
bash < <(wget http://git.io/kde-putty -O-)
Test the command’s result in your browser with the following link:
ssh://github.com
Note
The URL http://git.io/kde-putty points to the source file at https://raw.github.com/aaltsys/doc-configkde/master/_downloads/putty-kde.sh. The URL shortening command was curl -i http://git.io -F "url=https://raw.github.com/aaltsys/doc-configkde/master/_downloads/putty-kde.sh" -F "code=kde-putty"
Example PuTTY Session:¶
This program works magic which is best explained through an example, as follows.
An administrator wishes to connect to a remote Windows session running on a
network behind a Linux server. The Linux server is accessed at the domain
name https://HOSTNAME.DOMAIN.TLD
. Both the Windows session and the Linux
server authenticate username
and password
for logins.
First start a console on the local machine, then ssh to the remote server:
xdg-open ssh://`id -un`@HOSTNAME.DOMAIN.TLD
Now explore the remote environment to identify Windows RDP servers. Recommended commands are:
smbclient -L NETBIOSNAME
smbtree
These commands identify a windows session on host XPUSER
. Now find the IP
for this machine using either of the commands:
net lookup XPUSER
nmblookup XPUSER
Suppose the remote Windows terminal server XPUSER uses IP 192.168.2.243
in its local network. Display the PuTTY menu with <Ctrl-RightClick>
, and
choose Change Settings.... Then select Category:
Connection > SSH > Tunnels and enter:
3389
192.168.2.243:3389
Add
Apply
Finally, open the KRDC Remote Desktop client on the KDE Desktop, and connect
using protocol rdp
to localhost
. A remote Windows RDP session
will display as if it were local, being redirected to you over SSH.