CryptedNets.org

Linux

Building a linux terminal server with vncserver

by on Jun.09, 2017, under Computer Stuff, Linux

Sometimes you need to allow multiple people to login to a linux server, and run something that requires Xorg/X11/Xwhatever they’re calling it these days. (xenocara if you’re cool ;)
So, from the start. Install your OS, (I’m using Ubuntu) install gnome, xfce4, openssh-server and vncserver, and add your users.

  • Setting up your user accounts for VNCserver

Log in as your first user, and run the command: vncserver in a terminal. This will start an instance of the vncserver, and allocate an available port to you. It should look something like this:

username@laptop:/home/username$ vncserver
You will require a password to access your desktops.

Password: (enter password)

Verify: (verify password)

xauth: file /home/username/.Xauthority does not exist

New 'laptop:1 (username)' desktop is laptop:1

Creating default startup script /home/username/.vnc/xstartup

Starting applications specified in /home/username/.vnc/xstartup

Log file is /home/username/.vnc/laptop:1.log

Immediately after this, you’ll want to kill the server with:

username@laptop:/home/username$ vncserver -kill :1

You’ll want to do that for each user account, so later, we can use their passwd file to start the vncserver as a system service, so it will run the vncserver every time the server boots up. The next user you add and run vncserver for should get port :2 (or, 5902)

We can see that this was the first instance of vncserver to run on this server, because we were assigned port :1 (technically, port 5901)
This will also create the .vnc folder in your home dir. In my case, this is ‘/home/username/.vnc’. ┬áInside this hidden folder, you’ll find the passwd file you created when setting your password for vncserver, and the xstartup file that is created by default.

It doesn’t tend to be extremely useful out of the box, so we’ll replace the contents of it with this for a Gnome desktop in your vnc session:

#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
gnome-session &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

Replace it with this for an xfce4 desktop in your vnc session:

#!/bin/sh
unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey &

One you’ve got your xstartup configured the way you want it, run vncserver once more, and make sure that you get the desktop you expect when connecting.

Immediately after this, you’ll want to kill the server with:

username@laptop:/home/username$ vncserver -kill :1

  • Configure vncserver as a system service for each user

As of right now, each user would need to first ssh to the server, and start their instance of vncserver manually to take over an X desktop. This is not what we want. We want their individual vncserver instances to run every time the server boots, and this way, we can restart the vncserver instance for each individual user, rather than having to kill the entire server to reset one connection.

For that, we need to install some init scripts in /etc/init.d/ You need to be root to do this, or able to use sudo.

(at this point I wonder if I should outline how to edit files.. I feel like if you’ve read this far, you already know, or are googling it as I speak.. )

username@laptop:/home/username# vi /etc/init.d/vncserver-username

Insert the following into the newly created file:

#!/bin/sh -e
### BEGIN INIT INFO
# Provides: vncserver:1
# Required-Start: networking
# Required-Stop:
# Default-Start: S
# Default-Stop: 0 6
### END INIT INFO

# The Username:Group that will run VNCserver
export USER="username"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The name that the VNC Desktop will have.
NAME="username on Laptop"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '$USER' on localhost:$DISPLAY"
su username -c "/usr/bin/vncserver :1 -geometry 1920x1080 -geometry 1280x1024 -geometry 1024x768 -f ~/.vnc/passwd"
;;

stop)
log_action_begin_msg "Stoping vncserver for user '$USER' on localhost:$DISPLAY"
su username -c "/usr/bin/vncserver -kill :1"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0

IMPORTANT: To add another service for another user, you’ll need to copy /etc/init.d/vncserver-username to /etc/init.d/vncserver-newuser, and then edit the file for the new username and port info. Especially important is the “Provides: vncserver:1” line, as this is the name that the system uses to identify the service, and it must be unique for each instance of the service that you want to run. Name each user’s service for the port that they were assigned when they first ran vncserver. So, assuming that newuser got port :2, you’d replace ALL of the “username” with “newuser” and all of the “:1” with “:2”. Read carefully. ;)

Save and exit this file, and then make it executable:
chmod +x /etc/init.d/vncserver-username

Anytime you make a change to the init scripts, you have to tell the system:
systemctl daemon-reload

Now, update the runlevels:
update-rc.d vncserver-username defaults 99

Last, start your system service:
/etc/init.d/vncserver-username start

Leave a Comment more...

Upgrading VMWare ESXi hosts from the vSphere CLI

by on Jun.25, 2012, under Computer Stuff, Linux

1. Download the vSphere CLI, and the ESXi upgrade file you need from vmware.com.(~200MB)
(install the CLI, and save the ESXi update file as c:update.zip)
2. Place the ESXi host in Maintenance Mode and either power off or migrate all VMs on the host
3. Launch the vSphere CLI. (Start -> All Programs -> VMware -> VMware vSphere CLI -> Command Prompt)
4. type cd bin
5. Enter this command:

## For ESXi 4.x to 5.0:
vihostupdate.pl -b c:esxiupdate.zip -url https://SERVER_NAME_OR_IP/sdk/webservice -i

## For ESXi 5.0 to 5.0.x:
esxcli --server=SERVER_NAME_OR_IP software vib install --depot="[DATASTORE_NAME]esxiupdate.zip"

Provide the root account username and password when prompted.
After the install completes, you will be instructed to reboot your ESXi Host.
After your host comes back, exit maintenance mode, and start up your VMs

**UPDATE for ESXi 5.0 machines**

ESXi 5.0 uses a single installer wizard for fresh installations and upgrades.
ESXi 5.0 also provides a new option for deploying ESXi directly into the host
memory with vSphere Auto Deploy. The vihostupdate and esxupdate utilities
are not supported for ESXi 5.0. You cannot upgrade or migrate to ESXi 5.0 by
using any command-line utility.
After you have upgraded or migrated to
ESXi 5.0, you can upgrade or patch ESXi 5.0 hosts using vCLI esxcli commands

such as:

Install all new VIBs from a ZIP file on the target server, copied into a datastore
esxcli --server=SERVER_NAME_OR_IP software vib install --depot="[DATASTORE_NAME]esxiupdate.zip"

##IMPORTANT##
After you upgrade or migrate your host to ESXi 5.0, you cannot
roll back to your version 4.x ESX or ESXi software. Back up your host before
you perform an upgrade or migration, so that, if the upgrade or migration fails,
you can restore your 4.x host.

Leave a Comment :, more...

DMARC/DKIM is coming. You're all gonna have to learn about encryption.

by on Apr.15, 2012, under Computer Stuff, Linux, Mac OSX, Networking, OpenBSD, Windows Info

HAHAHAHAHAHAHA
Told ya.
Here it comes, check this out. If you work in the technology field, you need to read this:
http://dmarc.org/

Leave a Comment : more...

Sorry Ubuntu… Unity sucks out loud. You just lost me.

by on Feb.29, 2012, under Computer Stuff, Linux, Rants

I’ve been running Ubuntu since the beginning. Previous to Ubuntu, I was running either OpenBSD, or Debian for a workstation OS, depending on the purpose. I switched to Ubuntu on my desktop/laptop because of the stability, and excellent hardware support.
< RANT >
What I didn’t switch for was being forced into using a Fisher-Price(tm) user environment, that I can’t alter.
While still wanting a Debian-based OS for it’s BSD-ish feel and stability, I just can’t deal with the restrictive nature of Unity any longer. (And, I shouldn’t have to spend 2 hours removing/disabling it, and then another hour re-activating all of the Gnome features you’ve disabled, because they’re not compatible with your *creation*.)
< /RANT >
Last night, I downloaded and installed Linux Mint 12 (lisa). http://www.linuxmint.com/
I downloaded and burned the 1gb DVD image with Gnome 3 and MATE.
Upon installing, and booting up for the first time, Flash, Java, libav codecs, and everything else I need on a workstation was already installed and working. I. LOVE. THIS. OS.
So long, Ubuntu. And thanks for all the fish.
Linux Mint just works better than you do.

Leave a Comment : more...

Ubuntu 11.04 rocks mah werld.

by on May.01, 2011, under Linux

So, a couple of days ago, I did an in-place version upgrade to 11.04 on my laptop.
(Lenovo SL510 Core2Duo, 6GB of RAM, 300gb SATA)
Now, I *use* my laptop.. A lot. Every day. There are several applications at work that require Windows, so I boot virtual machines using Virtualbox, and bridge them to wherever I need them. After upgrading and rebooting, I logged in, and started a Windows 7 Enterprise VM, bridged to the wireless card. It started, I opened a web browser on the VM, and my homepage opened. This is not the cool part. Read on.
In the past, whenever I allowed my laptop to sleep, it would hang the X server, hang the VM, and sometimes even corrupt the disk image that was booted at the time. I haven’t been able to “sleep” this laptop since it was new. It *always* caused problems.
While my laptop was sitting there, freshly upgraded, with the VM booted and running and connected, I had an idea.
“Why not close the lid?” I thought. So, of course, I immediately did. I’m impulsive. whatever. ;)
I fully expected to open it up, have to switch to another virtual terminal, kill the X server, and start over.
This time, however, It. Just. Worked. tm
When I opened the lid, not only did the X server come back quickly, I logged in, was still online, and so was the *STILL WORKING* Windows 7 VM!! I had to do it 3 more times to make sure it wasn’t a fluke!! Since I probably spend somewhere near 6 hours a week shutting it down, and booting it up, this is fantastic!

Canonical rocks! Thank you for this release!!

Leave a Comment : more...

Just installed Virtualbox 4.0 on Ubuntu 10.10

by on Feb.19, 2011, under Linux, Mac OSX, Networking, OpenBSD, Windows Info

Now, with a preview of the running VM!! ;)

1 Comment more...

Linux as a Windows domain member server

by on Sep.06, 2010, under Linux, Networking

I’m not going to try to write a how-to on this, but suffice to say that it finally works!
I configured Samba3, PAM, and Kerberos on Ubuntu 9.10, and I can share folders to Windows client workstations using their existing authentication to the domain controller. I can even set ACLs that seem to be obeyed, and use Windows group membership to determine access rights.
Here are some links with relevant information:

The Samba WIKI (geared towards RHEL, but still helpful.)
How To Integrate Samba Using Active Directory For Authentication (geared towards Gentoo linux, but still helpful)
Ubuntu Samba info

I’ll certainly try to answer any questions you’ve got, just post ’em.

Leave a Comment more...

*kick-ass* personal streaming media server

by on Jul.15, 2010, under Amusement, Computer Stuff, Linux

I just installed Ampache on Ubuntu-10.04 LTS. All I can say is WOW. You need this… Right now…
I’ve got an mp3 archive somewhere in the neighborhood of 135GB, making it too large for traditional file sharing.
Ampache is the answer.

Leave a Comment :, more...

Ubuntu Eye Candy

by on Jul.11, 2009, under Linux

Linux has become a very utilitarian object for me. I use it in lots of places and situations to make life easier. In fact, most large OEM computer manufacturers have realised this, and use/ship Linux boot CDs to install firmware and low-level drivers. (some even facilitate the installation of a Windows OS to disk using GNU tools.)

Anyway, I’ve been running Ubuntu Linux (Intrepid) as a host OS on a Lenovo X61 tablet. It has everything I need for network engineering, security analysis, troubleshooting, and programming, right there up against the hardware. For tasks requiring the use of Windows, I can boot a virtual machine in Virtualbox, and use that. Today, after booting up, I noticed that I’ve been running the default Intrepid theme since install. I decided it’s time for a change. I went looking for themes, and found:

The Bisigi Project

Nice work, Mr. Vogelweith. Easy to install, beautiful to see. Thank you for sharing. I hope you don’t mind that I changed your logo just slightly, it wouldn’t show up here otherwise!

Leave a Comment more...

Antivirus on Linux

by on Feb.26, 2009, under Amusement, Linux

antivirus on linux is like lipstick on a pig… sure, you can put it there, but it’s a waste of time, and it annoys the pig…

1 Comment more...


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

CryptedNets.org is proudly powered by

Use OpenDNS

Entries (RSS) and Comments (RSS)
Register - Login - Stats

Visit our friends!

A few highly recommended friends...