How do you indetify an USB and get it mounted in your Linux?

I’m using a RaspberryPi to enforce myself to keep learning.

I’ve added an old 8Gb USB stick to the RaspberryPi. The Raspberry runs a very minimal Raspbian Strech Lite without assistants, or graphical interface, not even with the automunt command.

So, how do you identify the USB stick plugged and get it mounted or your Linux?

  1. Plug your USB stick to your RaspberryPi
  2. Run the command blkid as root.
    As an example I type:

    sudo blkid

    … and I get:

    /dev/mmcblk0p1: LABEL="boot" UUID="CDD4-B453" TYPE="vfat" PARTUUID="b1b51741-01"
    /dev/mmcblk0p2: LABEL="rootfs" UUID="72bfc10d-73ec-4d9e-a54a-1cc507ee7ed2" TYPE="ext4" PARTUUID="b1b51741-02"
    /dev/sda: LABEL="USB8GB" UUID="B21F-17E5" TYPE="vfat"
    /dev/mmcblk0: PTUUID="b1b51741" PTTYPE="dos"

    This line identify what device is used by the USB stick just plugged /dev/sda: LABEL="USB8GB" UUID="B21F-17E5" TYPE="vfat"

  3. Now we can mount normally the device by typing:

    sudo mount -t vfat /dev/sda /mnt/

What is the motivation of this post? I’ve to managed myself in order to get mounted the USB stick since the command lsusb gave me a lot of info but no so usefull, or simple, to get it mounted.

Privacy matters, very much.

In Europe a new reglamentation has enforce the privacy guarantees for citizens. I’ve used the default privacy policy page for this blog that WordPress offers.

And as soon as posible I’ll customized it in order to let it clear: I don’t collect any data because I’m very concern about privacy.

Please, privacy matters, you must stop using some software and services that collect all your data. Really.

Note: I suggest as a further reading:

What cloud solution to choose and why

There is no cloud. It’s just someone else’s computer.
Chris Watterston

The Cloud (PaaS, SaaS, IaaS, …, etc.) is a stablished as solution nowadays.

According to where is the hardware, it’s told that there’re three types of cloud implementation:

  • public: your solution it’s on provider datacenter
  • private: your cloud it’s on your own datacenter(s)
  • hybrid: your solution is on both; at external at provider’s datacenter and in your datacenter. Important, you are able to move apps, services, VM’s from one to another

Note: the same terms are used to describe if your solution is public in the Internet, or closed only for your company (private) or a mixed one (hybrid). So, let me insists, I’m describing where is your solution (hard + software). I’m not refering here to who is able to use it.

Ussually I miss another variable that impacts a lot: are you going to deploy your cloud solution in a vendor lock-in implementation or don’t? Many cloud companies offers their solution in the three environments (I think that Amazon only offers a full non on-site solution).

PROS: A ready to use solution provided by any vendor has advantages: easy and fast deploy, integration with other products (for instance: As an exemple, if we just have a look to Amazon S3 (Simple Storage Service), there’s a plenty of storage provider with S3 compatible solutions: EMC2, IBM, Veritas, Oracle (it seems that just for backup solution)).

CONS: Your footprint is that concept named vendor lock-in. Once they got you, they may charge you hidden cost and it may be painful to migrate from one cloud solution to another. Plus, on daily work you’re limited about the things you may see, modify, manage, or analyze if anythings fails. Think about this cloud infrastructure with renting a flat: there’s a landlord, you got everything ready for you as soon as you come into the flat, but… you couldn’t change anything in the house ’cause it is not yours home.

I prefer a hybrid solution based on open standards.

CONS: It costs more to get things done, but when you get it you control and decides architechture, services, and many times you may manage your resources, you are not out of the workshop while the vendor manage your solution and you don’t know what’s hoing on or what has happened during a failure. Obviously there’s a footprint too, it is not a ready-to-use solution.

PROS: On the other hand, you’re more free to manage and decide. More; hybrid is going to be the solution because the companies requires an agilty (growing, moving resources, etc.) that only can be satisfied by defining from the scratch a hybrid implementation.

Source: I found the author of the sentence There is no cloud. It’s just someone else’s computer. in the Command Line Heroes podcast Crack the Cloud_Open and it has makes me share here those ideas that I agree with.

How to modify every day login in Linux

Every time you log into a *NIX machine you are wellcomed by a text banner that varies from one *NIX to other, even among Linux distributions.

If you want to customized this message it’s fairly easy, you only have to edit (as a root) the file /etc/motd and the next login will show your new message of the day.

My two cents to a so simple task is enrich your file writting inside some ASCII art. For instance, you may use figlet to writte inside the /etc/motd file your hostname. In short:

  1. Be sure you have figlet installed in your system or install: in Fedora; type yum list figlet or (lazy way) yum list figl* and figlet may appears in one of both list, installed or available package.
  2. Add different messages to each login with fortunes. First, be sure you have fortunes installed in your Fedora and then, edit your .profile and add an invocation to the fortunes program.
    For instance, I add this:
    echo -n "### Fortune for "
    echo -n `date +%d\-\%m\-\%Y`
    echo " ###"

    I get this:
    ### Fortune for 22-04-2018 ###
    Computers are useless. They can only give you answers.
    -- Pablo Picasso

    BTW, I recommend to writte the full path to the fortune’s binary ’cause it’s installed out of the usual $PATH.

If you research a few over thhe Internet you may find differente fortunes collections, such The Simpsons, or my favorites inspired by BOFH.

How to ask for root password when using sudo

A minimal improvement to your security is asking for a password when you allow normal users to execute privileges command via sudo. Usually, they just type their own password and that allows they to gaing privileged status to execute what you have set in sudo files.

You should consider change this behaviour and ask for root password. Why? it’s too easy IMHO to execute a root command because the user (or impostor) only needs to know one single password and not your root password but someone elses one.

Instead of that setting I prefer to change sudo files to this in the /etc/sudoers:

Defaults rootpw

Before do that, be sure your root password is setted and accomplish a minimul security recommendations. It will not apply in current shells, but the new ones.