This quick post shows how to restart Samba Service on Ubuntu.
sudo service smbd start
sudo service smbd stop
sudo service smbd restart
In fact this should apply to more or less any service in Ubuntu.
When in doubt what services are running try this:
This will give you a list of all the services on the machine.
It looks something like this:
[ ? ] killprocs
[ ? ] kmod
[ ? ] libnss-ldap
[ + ] monit
[ ? ] networking
[ + ] nmbd
[ ? ] ondemand
[ – ] procps
[ ? ] rc.local
[ + ] resolvconf
[ – ] rsync
[ + ] rsyslog
[ + ] samba
[ – ] samba-ad-dc
[ ? ] screen-cleanup
[ ? ] sendsigs
[ + ] smbd
[ + ] ssh
[ – ] sudo
The legend for this is:
“+” = started
“-” = stopped
“?” = unknown
Why something is in status “unknown” I really do not know at the moment 🙁
So I needed to Install Webmin on Ubuntu server 14.x, to make it a Little bit easier for a Linux NOOB like myself to manage my servers.
Searching high and low I have here compiled what I had to do to get this done.
- Find a link for the webmin version that should be downloaded and installed here: Webmin Downloads in my case I chose to take the debian package, as I can install this and dependencies this way
- On your server do the following commands
- wget http://prdownloads.sourceforge.net/webadmin/webmin_1.770_all.deb
- dpkg -i webmin_1.770_all.deb (It will complain about missing dependencies if any, but do not despair)
- sudo apt-get -f install (This fixes the problems with dependencies)
After a short while you should see a message like this:
Webmin install complete. You can now login to https://linux:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
Fire up your browser and go to https://linux:10000 (Replace Linux with your servers IP or hostname)
Does not work stil ???
There could be several reasons but first of have a look here:
Maybe you need to configure the Ubuntu Firewall to open port 10000
Today we will take a look at how to open ports in Ubuntu firewall UFW
UFW is short for Ubuntu Uncomplicated Firewall.
Indeed it is right this firewall is really not that complicated.
So I had the task to open a port to my Webmin service located on TCP port 10000
First let us check what is up with our firewall
Give the command : sudo ufw status
Either you will get the response :
Status : inactive
or more likely if you really have the need for opening a port you will receive a list of open ports like this:
To Action From
— —— —-
22 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
The above shows that currently my machine will allow SSH,HTTP and HTTPS from anyone who would like to connect to these services.
The security freak will frown upon this. Especially that SSH is open for all, but hey this is how the virtual machine was delivered to me.
So in order for me to allow the Webmin service to be accessible, from my IP address I will enter the following command
sudo ufw allow proto tcp from 192.168.0.2 to any port 22 (Remember to replace 192.168.0.2 with your actual IP address)
If you do not care who accesses this port you could go with the command
sudo ufw allow 10000
that’s it and that’s that!
Note that firewalls may seem uncomplicated, but if you do not think carefully about what you are doing you may open allow for your machines to be accessed by people with bad intentions!
In this post we have a look at how to resize root disk partion on Ubuntu.
So I had to resize the root disk partition on one of my Ubuntu VM’s.
First I have expanded the .vmdk file as described in my previous post.
Now I had some un allocated Space available.
I thought I would find countless examples of how to do this via command line, but really there was not a lot that seemed to apply, since it was the root drive i needed to expand.
However one guy on askubuntu.com had the following answer which I did not test myself Possible way to expand Ubuntu root drive from command line
However what i did was to use a Tool called GParted.
(Always remember to backup your systems before perfoming operations like this)
- Download GParted live CD
- In my case i was running VMware so I mounted the ISO and booted on it
- Choose default settings (or customize if you need special language or other)
- In my case I ran with the GUI version
- Now take your swap partition and move it to the end of the drive
- Next expand your root drive.
- apply changes and Voila you are done, and your Ubuntu now has more Space available on root drive.
Of course your situation may vary from mine and the steps above needs to be changed in order to fit your environment.
Let us have a look at how to increase size of VMWare virtual disk.
Apparently there are several ways of increasing the disk size on a VMWare VMDK file, so below I will describe the way I have successfully done this in my virtual environment (vSphere 5.1).
(Note: This kind of operation can be harmful to your virtual machines and this information is provided without ANY warranty or responsibility for what happens when you do it! Make sure you have a proper backup before you engage in these activities)
First of all you need to have access to VMware ESXI Shell as described in my previous post.
After this we can start the work to expand our VMDK file.
Step 1 is to locate the VMDK file
- Log in to the VMware ESX/ESXi host as the root user.
- Run vim-cmd vmsvc/getallvms to list the location of the configuration files for the virtual machines registered on an ESXi host.
- Record the location of the .vmx file (configuration file) for the virtual machine that you are looking for. For example:/vmfs/volumes/46b2f3eb-ced4c7d8-c1d2-111122223333/vm1/vm1.vmx
- The results of step 4 list all virtual machine configuration files. Search the results for the name of a virtual machine file you are interested in locating. The results also list the path to the directory where these files are located.
- By viewing* the configuration file of a virtual machine, you can tell where all of its associated files, including .vmdk files, are located. If a file is not in the same directory as the configuration file the complete path is shown in the configuration file. For example, a second hard disk may have an entry such as the one shown below:scsi0:1.present = “true”
scsi0:1.fileName = “/vmfs/volumes/46b2f3ea-980a1c90-3333-00112233bb44/diskStore/secondHardDisk.vmdk”
- *Tip: Use the VI editor to view the content of the VMX file
This information is based on this article from vmware : http://kb.vmware.com/selfservice/search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=1003751
Step 2 will be actually expanding the file.
Virtual disks can be expanded using this ESXi/ESX command line command vmkfstools -X:
vmkfstools -X <new size> <virtual disk>.vmdk
Here is an example, use this command to grow the virtual disk to 25GB in size:
vmkfstools -X 25g /vmfs/volumes/xxxx/vmname/vmname.vmdk
Changes are made to the disk and are almost instant.
Partitions residing within the virtual disks will not resize and there will be unallocated space at the end of the disk.Third-party partitioning tools are required at this point to resize the primary partition to take advantage of the additional space.
VMware Converter allows you to specify a new disk size in its conversion wizard. It will also take care of partition resizing for you.
You can read more details on this if you need it here http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002019
So you need a deeper connection with your vSphere? Let us take a look at Enabling ESXi Shell access using vSphere Client.
Use the vSphere Client to enable local and remote access to the ESXi Shell:
- Log in to a vCenter Server system using the vSphere Client.
- Select the host in the Inventory panel.
- Click the Configuration tab and click Security Profile.
- In the Services section, click Properties.
- Select ESXi Shell from this list:
Direct Console UI
- Click Options and select Start and stop manually.
Note: When you select Start and stop manually, the service does not start when you reboot the host. If you want the service to start when you reboot the host, select Start and stop with host.
- Click Start to enable the service.
- Click OK.
Enabling ESXi Shell access using the Direct Console User Interface
Use the direct console user interface to enable the ESXi Shell:
- From the Direct Console User Interface, press F2 to access the System Customization menu.
- Select Troubleshooting Options and press Enter.
- From the Troubleshooting Mode Options menu, select Enable ESXi Shell.
Enable ESXi Shell
- Press Enter to enable the service.
This information is taken from http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2004746
This information is succesfully tested in several of my VM’s
- Go to Virtual Machine > Install VMware Tools (or VM > Install VMware Tools).Note: If you are running the light version of Fusion, or a version of Workstation without VMware Tools, or VMware Player, you are prompted to download the Tools before they can be installed. Click Download Now to begin the download.
- In the Ubuntu guest, run these commands:
- Run this command to create a directory to mount the CD-ROM:
sudo mkdir /mnt/cdromWhen prompted for a password, enter your Ubuntu admin user password.
Note: For security reasons, the typed password is not displayed. You do not need to enter your password again for the next five minutes.
- Run this command to mount the CD-ROM:
sudo mount /dev/cdrom /mnt/cdrom or sudo mount /dev/sr0 /mnt/cdrom
- The file name of the VMware Tools bundle varies depending on your version of the VMware product. Run this command to find the exact name:
- Run this command to extract the contents of the VMware Tools bundle:
tar xzvf /mnt/cdrom/VMwareTools-x.x.x-xxxx.tar.gz -C /tmp/Note:
x.x.x-xxxx is the version discovered in the previous step.
- Run this command to change directories into the VMware Tools distribution:
- Run this command to install VMware Tools:
sudo ./vmware-install.pl -dNote: The
-d switch assumes that you want to accept the defaults. If you do not use
-d, press Return to accept each default or supply your own answers.
- Run this command to reboot the virtual machine after the installation completes:
This information is taken from http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022525