I’m a byobu user for a long time, I love it for many reasons. But this is just a quick tip for extreme users like me. I mean people who use byobu for local consoles with remote byobu sessions running on top of SSH, for instance.
When prefix key combinations has to be sent to the remote host we have to press “Control + a + a” and finally the command that we want to send to the remote systems. This is not comfortable many times. So, I modified my configuration file for changing the prefix when I want to send remote commands to the nested byobu.
This is going to work this way:
Control + a
as a prefix for local byobu session.
Control + b
as a prefix for remote byobu session
Take a look on this screen capture where you can see byobu status bars stacked.
If you find useful the configuration that I described the only thing that you have to do is modify the configuration file: ~/.byobu/keybindings.tmux
unbind-key -n C-a
set -g prefix C-a
set -g prefix2 F12
unbind-key -n C-b
bind-key -n C-b send-prefix
Usually, simple things are the best, in the case I want to recommend an FTP server for Windows. This is a really simple but super useful FTP server for Windows. I’m using in Windows 10 and it works perfectly. Configuration is done in less than 10″ and installation is not required, I love that. Super portable.
Don’t expect sophisticated options but the most useful and advanced ones are there. If you need something like that my recommendation is:
When we have a file with a ‘dd’ of a full disk and we want to mount a partition of that disk, we have to use an offset for jumping to the beginning of the partition that we want to mount.
Using ‘fdisk’ command we can find the partitions of that disk copied inside a file.
fdisk -l FILE_WITH_DISK_INSIDE
Once partition table is shown there is a column called ‘Start’ using the corresponding number in this column for the partition that we want we can obtain the offset required for our mounting point. Reasoning behind that is multiply start sector per number of bytes per sector.
# OFFSET = START * 512
mount -o ro,loop,offset=OFFSET FILE_WITH_DISK_INSIDE /mnt
I hope thanks to this technical note next time that I forget how to get the offset I find it fastly.
If you don’t want to do that manually, there is a small tool called losetup which maps the partitions of a disk image on a file.
# example, attaching partitions to loopback devices
losetup -P /dev/loop0 DISK_IMAGE
# just mount the devices now, they are /dev/loop0pX where X is the number of the partition
# dettach this assignament:
losetup -d /dev/loop0
Reading time: < 1 minute
This is another short entry, in this case for recommending a service which we solve typical problem solved using a DNAT. Once we have a service on our laptop, or on a private server and we have to expose that service on the internet for some time or permanently usually we have to go the firewall, or router and create a NAT rule forwarding a port. This is a simple and powerful service which is going to solve that for you.
There is a free account for understanding and testing the service, other plans are available and especially affordable for professional requirements.
This is going to be a very short post entry, I just want to refer a very interesting mail relay (smart host) which define itself like:
Email delivery services built for developers, by developers
Combined with your language of choice, using the power of our robust cloud API couldn’t be easier.
Open a SparkPost account today and send up to 100.000 emails per month for free. The best is you can do using SMTP or using a REST API; really nice easy to use an powerful control dashboard simplify externally keys management, statistics, templates for mailings, and many more features.
Personally I love the service because is extremely useful to be configured on SSMTP service of Linux as a default relay host, for personal and professional use. Another use could be to check end-to-end mail services.
Personally I love the service, and if you want to send really big mailings theirs costs are very competitive.
Reading time: < 1 minute
Some time ago I found a ncurses based tool very small easy and useful to get a very fast and easy way to analyze disk usage in linux. This entry is just to remember the name of that tool because I always forget its name.
Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don’t have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like environment with ncurses installed.
To avoid that in future before filling the partition, it’s a good idea to install and run periodically: purge-old-kernels. Installation and example of use are:
apt-get install bikeshed
# keep three old kernels:
purge-old-kernels --keep 3
# if you want to put that in the crontab use that command
purge-old-kernels --keep 3 -qy
If you’re a Grub user don’t forget to run:
Personally I have a nightmare with that problem and Ubuntu, especially with version 12.04 which is installed in a lot of servers that I manage. I repeated the previous process a lot of times and in the end, I decided to document it because I always have to go to Google and find the proper steps to solve that problem.
Lately I found some useful web applications that publish a terminal application. This is very useful when you are traveling or you have a remote server which you want to maintain or access from anywhere. Also another interesting use of this kind of applications is as a terminal for embedded devices.
I tried to use them as my default applications but all of them have the same problem: keyboard shortcuts conflict with the browser. I’m very used to use a lot of shortcuts to manage my terminal application and remote shell and this is a problem because most of the shortcuts are redefined by your browser. May be it’s possible to disable browser shortcuts when you are using this kind of web applications but I didn’t find how.
I hope this small list is as much useful for you as it is for me:
Reading time: < 1 minute
Next commands are very useful when you don't have access to the vSphere UI and you have to access to VMWare Hypervisor using SSH or console:
# get the list of virtual machines
# get the state of a VM with #id: VM_ID
vim-cmd vmsvc/power.getstate VM_ID
# turn on the virtual machine with #id: VM_ID
vim-cmd vmsvc/power.on VM_ID
Another option to turn on the virtual machine using an Ansible playbook:
A long time ago I wrote an entry post about how to set up the SMTP in linux boxes using a relay system you can find the post here: Relay mail from your server without MTA. Remember that SSMTP is not a SMTP service for your system but it’s more than enough for all servers that don’t work as a mail servers. Historically Unix/Linux uses sendmail command to send system notifications but usually this mails are lost because system configurations are not completed. My advice in this sense is use SSMTP.
In the past I used to use SSMTP with a GMail account but security constraints in Google mail services make it difficult to configure today. The new alternative is set up a free Mandrill account as a relay host. Mandrill is a Mailchimp service that allows you to send a lot of emails without problems and there is a free account that allows to send up to 12.000 mails per month free, more than enough usually. If you don’t know how to set up a Mailchimp account the best option to learn how to do it is follow the support documentation it’s very good IMHO.
When you have a lot of linux machines to administer you need something fastly replicable. As you know use Ansible is a very good option. Then I developed a new Ansible role to set up Mandrill accounts to SSMTP services massively using Ansible.