date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,589,317,106,000
I was able to encrypt a directory so that it can not be deleted. And I encrypted the file in the folder. But then I was able to delete the encrypted file in the encrypted folder, in which case, encrypting them was pointless b/c it did not save my file from being deleted. To encrypt the folder, I used "sudo mount -t d...
I found the answer on a video. To lock a folder: "sudo chmod 700 filename" "sudo chmod root:root filename" To unlock a folder: "sudo chmod 777 filename" "sudo chown root:root filename" It's been working using these. I can not delete, move to trash, open, or copy after locking it. Thanks for the help!
How can I encrypt my folder so there is no access to its contents?
1,589,317,106,000
I am using Ubuntu and I have an encrypted flash drive which synchronizes with a folder on my desktop whenever I plug it into the computer (using rsync and a systemctl service that runs the bash script doing rsync whenever this exact device is plugged in). How could I create a passwordless encrypted flash drive that a...
You're using cryptsetup, it has an option to use a key file instead of a password, so just use - - k e y - f i l e I don't know how your rsync & systemctl is set up to do the other things automatically, but just add the cryptsetup --keyfile... decrypt command in there. You might want some other method to ensure th...
Passwordless encryption of flash drive
1,589,317,106,000
Is it possible to encrypt a LMV partition after having installed an OS? I just finally managed to get LVM but I couldn't figure out how to get it encrypted. The installer didn't seem to provide for that to happen. To be more specific, I installed Lubuntu 18.10 which utilizes the Calamares installer. I've installed Lub...
@ThatRandomGuy, You have already done with installation so / file encryption is not possible. During installation you need to tick the check box "Encrypt the new Lubuntu installation for security" as shown in below figure. In case if you need to to encrypt home it possible by following below article. Creating Encryp...
How to encrypt LVM partition with LUKS after installation?
1,589,317,106,000
I have the second half of my hard drive encrypted. Now I want to encrypt the first half as well. Being the second partition I can't extend the LUKS partition. Can I add the first partition to the existing LUKS or do I have to set another LUKS for this one partition?
You'll need to create another LUKS container. Your LVM volume group can span both LUKS containers. You'd simply create an LVM physical volume in the LUKS container and add it to the LVM volume group. However, that means both LUKS containers would need to be unlocked before you can bring up the LVM volume group.
Add new partition to LUKS+LVM
1,589,317,106,000
I have a common setup of two OpenVPN clients (A and B) that are both connected to the server S. According to this question, each client has an encrypted channel with the server, but the server strips down the encryption in order to route the traffic to another client. For my understanding, if the server gets compromis...
It's in principle possible to use OpenVPN in onion-like layers. Let's assume that you are forced to keep layer 1 (L1) unchanged: S stays the L1 open VPN server A and B stay L1 clients of L1 server S Below L1, we add L2 as follows: A acts as the L2 open VPN server B acts as a L2 open VPN client of L2 server A With ...
OpenVPN multiple client communication with end-to-end encryption
1,589,317,106,000
I'm on debian 9 I want to boot from an encrypted root,using a usb key Editing /etc/crypttab... cifr /dev/md0 /dev/disk/by-uuid/88D9-A79B:/FILE luks,keyscript=/lib/cryptsetup/scripts/passdev Reboot..works fine. Only one problem,systemd stuck with this error,then boot..but I have to wait 1:30 minute! journalctl retur...
Solution found. The command /lib/systemd/system-generators/systemd-cryptsetup-generator Convert the /etc/crypttab in systemd service. But it add those bad lines wich cause error After=dev-disk-by\x2duuid-88D9\x2dA79B Requires=dev-disk-by\x2duuid-88D9\x2dA79B So the solution is,after boot run /lib/system...
Systemd and encrypted root on debian
1,589,317,106,000
Security is highered if only one machine can do the decryption. How would you suggest to allow only one computer to be able to decrypt an LUKS partition? I would simply need to get a set of variable specific to my machine and add them in the passphrase but I don't which one to choose. Which variables would you choose ...
Security is highered if only one machine can do the decryption. Availability can take a serious hit if that machine goes bust, though. How would you suggest to allow only one computer to be able to decrypt an LUKS partition? I would simply need to get a set of variable specific to my machine and add them in the pas...
How to set a machine specific encryption to allow only one machine to decrypt data
1,589,317,106,000
I installed FreeBSD 10.1 and chose to encrypt the ZFS root volume and Swap during install. I'm now realizing that on the remote KVM vserver I'm on the encryption makes rebooting harder and probably doesn't have the security effect I had in mind when I installed FreeBSD (all disks are decrypted as soon as I enter the p...
Unfortunately, there isn't going to be an easy way to disable the encryption because the bits are already encrypted on disk. So a re-install with the encryption disabled may be your only option.
FreeBSD 10: Disable ZFS full disk encryption
1,424,518,278,000
I cannot change my login screen background to the desktop background in my elementary os which is based on ubuntu. I have decrypted my home folder according to this link: http://www.howtogeek.com/116179/how-to-disable-home-folder-encryption-after-installing-ubuntu/ and when I ran the command to check for encryption I ...
Got it! 1) Copy all the pics to /usr/share/backgrounds 2) Then take terminal and change directory to that folder. cd /usr/share/backgrounds 3) Then for every image_name.jpg that you just added, type the command: sudo chmod a+rw image_name.jpg 4) Now exit terminal and check your System settings -> Desktop . Yo...
cannot change my login screen background
1,424,518,278,000
I will install Ubuntu 11.04 to an encrypted VolumeGroup with the installer: https://i.sstatic.net/Skil9.png AES Blowfish Serpent Which one is the fastest from these 3? Or Using AES with only a 128 bit key gives the best performance/speed? Does someone has a graph/statistics about them? (or e.g.: what is the performanc...
This table shows that AES with 128 bit keys would be faster. In fact, even with 256 bit keys it'd be faster. (of course, a comparison chart for the exact implementation would be better). That being said, since it's such a popular algorithm I'd be tempted to pick it based on popularity because it's something you're g...
What encryption to use for good performance?
1,424,518,278,000
I have a USB stick encrypted with LUKS + Ext4. I have forgotten the password... However, I know which words will be included in the password and have a list of all permutations of those words. About 10,000 permutations. Instead of me trying each and every permutation 1 by 1 manually (which will be a long, slow, and ...
Well, in the most naive case you can roughly do something like for a in 'fo' 'foo' 'fooo' do for b in 'ba' 'bar' 'baar' do for c in 'bz' 'baz' 'bazz' do echo -n "$a$b$c" | cryptsetup open /dev/luks luks \ && echo "'$a$b$c' is the winner!" \ && break 3 ...
Automate multiple password enties to decrypted LUKS + Ext4 USB stick
1,424,518,278,000
I'd like to know if there are other tools like gpg to encrypt a file using AES encryption. I'd like the encryption to be a standardized format so I can use a programming language to decrypt the file on the other end. I am aware of zip file format but thought there might be more than this?
It may be impossible to do better than GPG's decades of secure tested encryption, but there are some other encryption tools available, ArchWiki has good info on them here https://wiki.archlinux.org/index.php/Disk_encryption Though they focus on disk & folder encryption you could encrypt a folder at a time, or treat ...
Is there a common tool besides gpg for encrypting files in AES?
1,424,518,278,000
When a daemon is executed, is the executable copied to memory? If so, can it be copied encrypted? If not, is there a way to prevent the executable from being copied to memory? The executable is stored on an encrypted tmpfs.
When a program is executed, the necessary code pages are loaded into memory on demand. This is transparent: the kernel loads the pages when it needs them, and tries to be smart by preloading pages that are likely to be needed soon. The code has to be decrypted before it can be executed. If the code is stored on an enc...
are daemon tmpfs executables copied unencrypted to memory upon execution? (prevent if so?)
1,424,518,278,000
If I use openssl to generate some random data (for a keyfile, for example): openssl rand -hex 2048 >/tmp/file Is this 4097 bits (or bytes?) of entropy? -rw-rw-r-- 1 username username 4097 Oct 30 20:01 /tmp/file
Is this 4097 bits (or bytes?) of entropy? Neither. Entropy is a property of how the random data was generated (see, e.g., this Crypto.SE post), not how much of it was generated. If openssl rand could generate data with x bits of entropy, that would still be x bits of entropy irrespective of whether you told it to ou...
Entropy: whats the difference between bits and bytes?
1,424,518,278,000
I encrypted a disk using cryptsetup. I want to be able to visualize that a known text before encrypting the disk became gibberish after encrypting. How do I do such comparison? Here's an example for the best scenario: In a decrypted disk, assume I make a text file that has the word "test string" inside it. I will so...
For example, consider the server I work on. The hard disk has a small /boot partition, /dev/sda1, which is by necessity not encrypted, and a large encrypted partition, /dev/sda2, which hosts a LUKS container, which, when opened by cryptsetup automatically at boot after entering the passphrase, appears as /dev/mapper/S...
After encrypting a disk, how do you check that a known plain-text inside the disk became gibberish? [closed]
1,424,518,278,000
My system has full disk encryption except for /boot. I've set a GRUB password by following this post, but then was able to disable it by booting into Kali Live and running: mkdir /mnt/dev/sda2 sudo mount /dev/sda2 /mnt/dev/sda2 sudo vim /mnt/dev/sda2/grub/grub.cfg 3 commands. Easy peasy. A user will only see the GRUB...
By that logic, why use any passwords at all? After all, one can simply move the disk from one computer to another and access anything as root. User or bootloader passwords in general are not designed to stop data access, encryption is designed to do that. GRUB passwords are not about restricting data access or modific...
GRUB password seems useless, so why even bother?
1,424,518,278,000
I aim to hide data into .txt and .xml files, from Linux OS, aand keep it readable on any OS. With Apple OS (OS X), I used to write 'secrete' data into files (actually in the Resource Fork of the file), but out of the content of the file. Example: a file bob.txt, when you open it with Text.app it displays "hello you",...
What you describe on MacOSX is just storing regular data in the data fork of a file, and "secret" data in the resource fork. Major Linux filesystems provide a more general mechanism, called extended attributes, which can be written using the setfattr command and read back using getfattr. For example:: $ echo "Hello, ...
Add data in a file, but not out of content? (steganography)
1,424,518,278,000
A system is installed with an encrypted VG. How can I find out if they used dm_crypt or luks? It's running Fedora 14, so I think it's one of those. Or are they the same thing?
I am creating a new answer because the currently accepted answer is incorrect in calling them the same. LUKS adds key management to dm-crypt. It's Linux Unified Key Setup. Without LUKS, you can only have a single master password. LUKS allows you to have multiple keys that can decrypt the single master key that the d...
Is the VG encrypted with dm_crypt OR luks? How to find out?
1,424,518,278,000
I just did a fresh install of ubuntu server with encryption. However from the looks of it I am unable to access the majority of the space. I believe its not mounted to a directory but it shows as mounted because the root directory. How can I either mount the 3.6T to /home or extend the root to use the whole disk space...
The whole 3.6T encrypted partition has been assigned to be managed by LVM, but only 100G of it has been actually allocated for use as your root partition. You can't mount the /dev/mapper/dm_crypt-0 directly, because it has been initialized as a LVM physical volume (PV for short) which acts as a container for one or mo...
No understanding Why i cant access dm_crypt-0 -> LVM2_Member
1,424,518,278,000
I am not new to Linux but I am new to Linux Mint since I switched from Ubuntu due to reasons out of scope of this question (snapd, update borked my computer) I selected for FDE (Full Disk Encryption) during the graphical installation process. I then saw the option to encrypt the home folder and I clicked that as well....
I have answered the question by myself. I emailed Clement (project leader of Mint) and this was his response: You can have one or the other, or both, or none at all. FDE is faster and safer (it doesn't just encrypt your home, but also the entire HDD including swap, temporary files which might be left on the HDD..etc....
(Linux Mint) Does selecting "Encrypt Home Folder" after you chose Full Disk Encryption only encrypt the home folder?
1,424,518,278,000
I'm running Arch Linux. I want to clone a 2 disk encrypted logical volume in a single volume group (LUKS on LVM). There is a slight catch. I want to swap some of the drives. I have: VG1: LV: PV(OldDrive1) + PV(OldDrive2) sda (OldDrive1) -vg1-luks_encrypted_lv sdb (OldDrive2) -vg1-luks_encrypted_lv I have tw...
"Need" is a strong word - there is more than one way to achieve what you want. With pvmove, you could do it on-line, while the encrypted LV is in use. 1.) pvcreate NewDrive1 2.) vgextend VG1 NewDrive1 3.) pvmove OldDrive2 (means effectively: "move any LVM-allocated extents from OldDrive2 to any other drive(s) in VG1 s...
LVM: How to clone multi-disk encrypted logical volume?
1,424,518,278,000
I've setup a server with luks devices (not used for root partition), they are listed in /etc/crypttab this way # <target name> <source device> <key file> <options> luks_device_1 /dev/mapper/vg-lv_1 none luks ... I've also setup a tang server and bound the devices to tang using the command clevis luk...
Actually, according the manpage clevis-luks-unlockers(7) having the option _netdev in /etc/crypttab is necessary to trigger the automatic unlocking. After a reboot, Clevis will attempt to unlock all _netdev devices listed in /etc/crypttab when systemd prompts for their passwords. This implies that systemd suppo...
tang / clevis: automatic unlocking for luks device not triggered unless defined as _netdev
1,424,518,278,000
openssl this way can only encrypt small files: openssl rsautl -encrypt -pubin -inkey public_key.pem -in secret.txt -out secret.enc openssl as I found suggested here throws an error: openssl smime -encrypt -aes-256-cbc -binary -in secret.txt -outform DER -out secret.txt.der public_key.pem not that you're supposed to ...
Well, the first problem is that you really don't want to encrypt a large file with an asymmetric cipher. Nobody does this, as they are slow, and limited in size in any case. What you do is create a session key for a symmetric cipher, encrypt the session key with the asymmetric cipher, encrypt the large file with the...
How can I use an unsigned public key to encrypt a large file using openssl?
1,424,518,278,000
I'm new to GPG and I've learned some basic GPG commands recently. I just found that using the same GPG command to encrypt the same data always generates different result. Below is an example. Is is normal? I took a quick look at the GPG man page and found there is a parameter --faked-system-time which seems indicates ...
Yes, GnuPG stores the time in the encrypted data. To see this, run echo xxx | gpg -ear [email protected] > encryptedexample (using an id for which you have a private key), then gpg --list-packets --verbose encryptedexample will end with something like :literal data packet: mode b (62), created 1599715776, na...
Same gpg command applied on the same string but got different result
1,424,518,278,000
I have an encrypted external disk on a linux server. On the server, I can do this locally to decrypt cryptsetup -d keyfile luksOpen /dev/sdx1 /mnt/decrypted but I prefer to avoid doing that on the server side. I want to access the server (via ssh/sshfs) and only decrypt the data remotely on my client machine. To acces...
I can mount and decrypt luks remotely (via sshfs) if I use a luks container (and not a luks partition) to hold the encrypted data. I just had to create a luks container (a file that holds internally the encrypted filesystem), this file is a normal file on a mounted partition so it can be mounted remotely via sshfs an...
mount crypto_LUKS partition without decrypting (locally)
1,424,518,278,000
I have a file that is decrypted with a similar command: gpg --batch --yes -q -d --passphrase-fd 0 -o "/var/file.out" "/var/file.gpg" < /var/secret.key I want to change the content of the /var/file.gpg but the decryption should continue work as before. Any idea how to encrypt it (I was able to find some examples with...
Ok. I've found what I needed: passphrase=$(head -n 1 /var/secret.key) gpg --symmetric --batch --yes --passphrase $passphrase --output some.gpg toEncrypt.txt
How to encrypt file with gpg and a passphrase only?
1,424,518,278,000
I apologise if this is not the correct community. I have a string that I believe was encrypted using an RC2 cipher. I know the secret key and the IV but I am struggling to decrypt it using OpenSSL. I know what the plain text should be. $ echo MY_CIPHER_TEXT | openssl enc -d -base64 -rc2 -iv MY_IV I am prompted for t...
Knowing the algorithm RC2 isn't enough; you also need to match the mode of operation and for some modes padding scheme. OpenSSL commandline (and for the most part the EVP API as well) defaults to CBC mode and 'PKCS5' (technically PKCS7) padding, which may or may not be correct. openssl enc by default does password-bas...
OpenSSL Usage to decrypt a string
1,424,518,278,000
I wanted to create bootable usb (dd bs=4M if=input.iso of=/dev/sdc) but sdc is my hard disk with two partitions: 1 simply ext4 and 2 encrypted LUKS. After this action I got Windows installed on my hard disk. How to recover encrypted partition after run dd comand?
It depends whether you have overwritten the beginning of the encrypted partition. The beginning of the encrypted partition is where the key is stored¹. If you've lost that, the data is undecipherable, and the only solution is to restore from a backup. If you only overwrote the first 4MB of the disk, and if the non-enc...
How to recover encrypted partition after dd command [closed]
1,369,798,071,000
I have found a few old posts claiming that tmpfs can execute in place. Is this true? If so, how? If not, is there a ram drive alternative? Can this be done with a ram drive that is encrypted? If so, how?
You're going to need some very specialized hardware to do what you're trying to do. Here are the constraints: The program must be in RAM, because that's where the CPU can find it. It doesn't matter how it got there. The program must not be in RAM unencrypted. I don't know where you want to store the encryption key....
Execute in Place an encrypted ram drive
1,369,798,071,000
If I encrypt a ZFS disk that is in mirrored or in RAID-Z (raidz, raidz1, raidz2, raidz3) configurations then what happens if a disk fails. Can I still access the data if I replace a HDD.
I can't answer this with specific regard to Linux, but assuming you're talking about either full-disk or full-partition encryption, my experience with ZFS on FreeBSD suggests that it won't matter. As long as ZFS can import the pool, you'll be able to remove a failed drive, provision a new drive with or without full-(d...
encrypted ZFS disk failure
1,369,798,071,000
I am testing to add a user to my database with a bash script! my code for my bash script is : mysql -u root <<MYSQL_SCRIPT USE mail_server; INSERT INTO mail_server.virtual_users (`id`, `domain_id`, `password` , `email`) VALUES ('1', '1', ENCRYPT('test@test', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), '[email ...
Your problem comes from the fact that whithin a here-document (the <<SOMETHING thing), $, \ and ` have a special meaning. To avoid this, you should switch to a version of the here-document where these characters are no longer special, by quoting any part of the first delimiter. Examples are any of these: mysql -u root...
encryption password by script failed
1,369,798,071,000
I have read `cryptsetup luksOpen <device> <name>` fails to set up the specified name mapping https://www.saout.de/pipermail/dm-crypt/2014-August/004272.html And tried cryptsetup open --type luks <device> <dmname> --key-file /root/luks.key still getting error 22 cryptsetup luksFormat <device> --key-file /root/luks....
It's a naming conflict, I already have /dev/mapper/data due to the previous testing, so have to test it with another name. cryptsetup open --type luks /dev/data new_name # 1st time sucess cryptsetup open --type luks /dev/data new_name # 2nd time fail
cryptsetup failed with code 22 invalid argument
1,369,798,071,000
On the Fedora wiki it is mentioned that LUKS offers this protection. LUKS does provide passphrase strengthening but it is still a good idea to choose a good (meaning "difficult to guess") passphrase. What is it exactly and how is it accomplished?
A similar phrase appears in other places (e.g., this Red Hat 5 page), where a bit more detail is given: LUKS provides passphrase strengthening. This protects against dictionary attacks. Just from that I would expect it to mean that the password is being salted and probably has other improvements applied to the ...
In regards to dm-crypt with LUKS, what is meant by "passphrase strengthening"?
1,369,798,071,000
I'm trying to encrypt some files using openssl , it showing me following error openssl: relocation error: openssl: symbol EVP_mdc2 version OPENSSL_1_1_0 not defined in file libcrypto.so.1.1 with link time reference Do I have to reinstall it ? or some dependencies ?
From Wikipedia Because of patent concerns support for MDC-2 has been disabled in OpenSSL on most Linux distributions and is not implemented by many other cryptographic libraries. The algorithm itself is available in OpenSSL, but it is not compiled in. If you really want to use it, download the source package, modify...
Openssl Relocation error
1,369,798,071,000
I import [E] subkey to different folder from ~/.gnupg, and export subkey's public key with --homedir option. I can see subkey's public key has less lines than master's plublic, using diff results that they has some starting lines the same, but then different lines at the bottom so at the end it's still different publi...
In asymmetric cryptography you always deal with key-pairs. For each secret key there is a corresponding public key. So to answer your first question: yes, the public key of a primary key pair is different from the public key of its subordinate key pair. I tried to reproduce your experiment and created a GnuPG test key...
GPG: [E] subkey's public key is the same as master's public key?
1,369,798,071,000
So I have LVM on LUKS in Arch Linux. My whole disk is encrypted and my boot partition is on an external disk. So do I need to encrypt the swap partition if the disk is encrypted when powered off?
If you’re swapping to a logical volume in your encrypted LVM on top of LUKS, then no, you don’t need additional encryption for your swap, it’s already encrypted.
If I have full disk encryption do I need to encrypt the swap partition?
1,369,798,071,000
I want maximize the number of folders encrypted with ecryptfs and decrypted at login with the module pam_ecryptfs.so. Which folders cannot possibly be encrypted before login in? I guess a lsof ran by pam_exec.so should give me the answer. Do you have a better strategy? Example of whitelisted folders: /boot, /etc/pa...
Ecryptfs is designed to encrypt a user's home directory. Although it can be used otherwise, it wasn't designed for that and won't be easy to set up. Ecryptfs normally gets mounted at login time, so it can only encrypt the user's data. A user's data is normally under the user's home directory, that's what the home dire...
What are the folder that I cannot set as encrypted folders decrypted at login? [closed]
1,369,798,071,000
I would like to know about the safety of RSA based encryption, especially when used to encrypt files with gpg or encrypt connections over ssh. Is it possible to reconstruct a working private key, given some public key? Is it easier to decrypt one small file? Or is the complexity of decrypting a small file equal to th...
You should read the manual, it explains a lot. I'll comment mostly. The public key in RSA consists of 2 large carefully chosen primes that are multiplied. To attack RSA, the attacker needs to find these factors. So yes, actually, when you publish your public key the attacker knows what number to factorize. But in fact...
RSA: private key safety? (ssh/gpg) [closed]
1,369,798,071,000
Our company needs to exchange data with a vendor using 128 bit AES encryption. Everything I've read suggests that AES can encrypt files using a passphrase not a pre-shared key. Is there a way to create a shared key between us and the vendor to encrypt/decrypt AES encrypted files? I could use any tool but I'm partial t...
I'm not sure what do you mean by pass phrase vs PSK. A PSK key could be a pass phrase. If OpenSSL is not a requirement, a very good tool to perform file encryption in command line is mcrypt. Mcrypt supports AES 128, 192 and 256 bits encryption and has all the options one would expect to find in a standard encryption s...
OpenSSL - how to encrypt files with AES key
1,369,798,071,000
I want to make my linux laptopwith LUKS Encryption. OS : Mint 17. Is it better to make the disk LUKS-encrypted: at the installation process ? after it ?
During the installation, the installer will show you an option to encrypt the disk with LUKS.
Mint, install and LUKS/LVM
1,369,798,071,000
I have a kind-of-raspberries park, all connected via VPN to a single one server. I'd like to encrypt each rasp', in order to avoid intrusions, if one is stolen. Each rasp' has already a system installed (Mint, debian-based). What would be the best encryption tool to use ? The rasp is connected by VPN to the server. Ea...
In your application, you want to protect at least: The actual media files obtained from the server The VPN keys that allow the Raspberry to connect to the VPN (otherwise an intruder need only extract that key, connect to the VPN themselves, and get the files) You can encrypt only those things, or you can encrypt the...
Encrypt Debian-based system
1,369,798,071,000
I have an encfs container in my home directory. I had been using Cryptkeeper to open the container, but since updating to Linux Mint 17 from 16 it's not working any more. Gnome Encfs manager doesn't work either. I've also tried mounting the container from the command line using these directions, but no luck. The name ...
Please try encfs ~/.rthg_encfs ~/rthg
Mounting Encfs Container
1,369,798,071,000
I have the server's webroot directory mounted on a partition which is being protected with LUKS encryption. I want to know what happens to the files within when that partition is being decrypted. Does a copy of the unencrypted version of these files goes to the RAM, or; a copy of the unencrypted version of these file...
LUKS is a block device encryption layer which sits on top of a block device and encrypts/decrypts all accesses to that device. No unencrypted data ever touches the physical device. LUKS then provides a virtual block device which gets used by the system to access the files. It is thus transparent to applications, which...
What happens to the files when they are being decrypted?
1,369,798,071,000
How can I force pidgin to use only encrypted connections when using MSN chat? I'm on Ubuntu 10.04
It isn't encrypted, you can use the off-the-record plugin that's available as a third-party plugin for Pidgin. FYI Off the record is available for Gaim, Adium and also as a compiled binary for Pidgin on Windows.
Is MSN chat encrypted or not? If not how can I make it encrypted?
1,710,439,366,000
Does anyone have a solution for using the Yubikey Security Key as a second factor for file-based crypto containers like VeraCrypt or something else? I know the Security Key doesn't allow PGP, but now I don't have another key.
I'll assume you're on Linux. Short answer, from the top of my head: should be no problem. LUKS can be used to create encrypted files, then you can put a file system in there, and mount the result. Something like the following (untested!): CONTAINER=yans-encrypted-image-file DEVICENAME=yans-volume fallocate -l 10G "$CO...
Yubikey security key for file based container
1,710,439,366,000
On Linux is possible: with luks+ext4 or luks+btrfs there are a lot of how-to's on web. Is also possible using ZFS. On Solaris 11 is possible something like this? Using a passphrase on boot is ok only in interactive mode, with an headless pc without a "remote control" like ILO4 or similar is not nice
Still open to a solution the actually answer is NO.
Solaris11: is possible to create an encrypted root and unlock it via usb?
1,710,439,366,000
I checked: https://cateee.net/lkddb/web-lkddb/CRYPTO_RSA.html The help text is: Generic implementation of the RSA public key algorithm. Is this driver for an encryption HW device, ex: from Intel/AMD CPU?
No, CRYPTO_RSA provides a generic implementation of RSA, i.e. one which isn’t hardware-specific. It works on any system the kernel works on.
kernel config, CONFIG_CRYPTO_RSA, what is this config for?
1,710,439,366,000
I wanted to encrypt a flash drive but it didn't went well. Then I tried to remove the encryption but I am unable to do it. Here is some info: LUKS header information Version: 2 Epoch: 4 Metadata area: 16384 [bytes] Keyslots area: 16744448 [bytes] UUID: 9f4cbeda-4733-4aa9-873f-764705300bee ...
You cannot "remove" LUKS encryption AFAIK, you need to format/recreate your partition. Steps to convert it back to a normal USB drive: sudo unmount /mount/point sudo cryptsetup close /dev/mapper/name cat /dev/zero > /dev/device1 sudo mkfs.ext4 /dev/device1 (or mkfs.exfat/mkfs.vfat/mkfs.ntfs) The cat command is not st...
Remove Cryptsetup LUKS encryption [duplicate]
1,710,439,366,000
At reboot, with USB sticks inserted, the TPM will not allow passphraseless booting of the server. With a USB HDD inserted passphraseless booting of the server is possible. Our servers are running Centos 8.3 with Linux kernel version 4.18.0-240. TPM2 modules are used with LUKS version 1 encryption of an LVM group consi...
We have figured out which PCR value changes after a USB stick gets inserted and the system reboots. By not binding to that PCR value we managed to boot off the TPM with a USB stick inserted. In our case PCR 1 (BIOS config) kept changing when a USB stick was inserted and the system rebooted. The command we used to quer...
Not booting off TPM with USB disk inserted
1,710,439,366,000
I have added a second disk to my LVM system. I created a physical volume there, added it to the volume group of ubuntu, 'vgubuntu', extended logical volume to fill the whole disk. How do I extend the LUKS system partition to fill the whole logical volume? Here's more info provided by pvdisplay, vgdisplay and lvdisplay...
You have LUKS configured on the PV level so "under" your LVM setup so unfortunately you need to start over -- your PV must be encrypted you can't "extend" the existing LUKS/dm-crypt device to the second disk. The structure should look like disk -> partition -> LUKS -> PV -> VG -> LV (it is possible to configure encryp...
How do I extend LUKS partition to fill the whole logical volume of 2 disks on LVM?
1,710,439,366,000
I am trying to set up SELinux and an encrypted additional partition that I mount at startup using a systemd service. If I run SELinux in permissive mode, everything runs ok (partition is correctly mounted, data can be accessed and service runs properly). If I run SELinux in enforcing mode (enforcing=1), I am not able ...
Solved assigning to cryptsetup the lvm_exec_t context. In the lvm.fc file cryptsetup was defined as /bin/cryptsetup but I had to change it to /usr/sbin/cryptsetup where it actually was.
SELinux and cryptsetup: chown failed and can't access temporary keystore
1,581,905,517,000
BACKGROUND: I have already created a passphrase list to use with bruteforce-luks. Unfortunately, that list was not enough to find the correct passphrase. I am assuming I missed out a word or 2. I am fairly sure some or all of the words are in the actual passphrase, but I am unsure of the remaining possible 1 to 3 w...
Solution: Create program which allows you to type in all the words you usually use in passwords. Run the program which will do a sort of permutation but not only change the order of the words, but also build up the number of words used per permutation. Save the generated passphrase text file (ended up being over 5,00...
Using cores on multiple servers for bruteforce-luks [closed]
1,581,905,517,000
Wanted to create a list of all the benefits of always running from a live CD (with or without persistence/as long as personal data is saved on encrypted drive locally)?
Using a live ISO without persistence means the main filesystem is read-only, so nothing can be changed or "broken" permanently. It also means all changes (new files & data) are in ram and lost on reboot/shutdown. Saving your personal data manually could lead to better backup habits... If you have enough ram to use the...
what are the benefits of always running from live cd for data protection? [closed]
1,581,905,517,000
Ok, so I've been debugging the last update of my system and found this warning running journalctl -b -p warning: systemd-cryptsetup: Key file <location> is world-readable. This is not a good idea! Generally I understand what is the matter and that it's bad. Though I don't know how to fix this properly without ruining ...
Ok, so indeed 600 permissions are considered a good and the only good practice for securing a key file (source: archwiki). Also the tricky thing here is that when the kernel is updated initramfs generation procedure resets the key file permission to 644 which basically allows to dump it's content. That means that aft...
systemd-cryptsetup key file readable warning
1,581,905,517,000
I have a encrypted container containing a mountable EXT2 file system with no partition table. How can I mount that file using cryptsetup? My attemps fail with 'VFS: cant find ext4 filesystem'...
To open and mount an encrypted container using plain mode: sudo cryptsetup plainOpen Container DecryptedContainter sudo mount /dev/mapper/DecryptedContainer /mnt When you are done, unmount and close the container: sudo umount /mnt sudo cryptsetup plainClose DecryptedContainer Use the appropriate names for Container ...
Testing password against encrypted ext2 container
1,581,905,517,000
I need to create a Rc2Key variable and then convert this to hexadecimal. I have done this with two commands. The Rc2Key variable has to be 16 characters long, so in my test module I used "DummyRC2Key1" as the Rc2Key. Rc2Key="DummyRC2Key1" HexRc2Key=$(printf "${Rc2Key}" | xxd -p) With that done I need to pad the CT...
Rather than tr d '/n'; you probably meant tr -d '\n';
Hex has unknown character / in the output
1,581,905,517,000
I recently installed Ubuntu 14.04 on my laptop. I already had a single Windows 7 partition and two linux partitions. The problem is that Ubuntu overwrote the grub bootloader, and now there is no option to boot to my encrypted debian install Here is my disk layout Windows partition /dev/sda1 Extended partition /dev/sd...
You can boot a live CD and chroot into the encrypted disk. From there, you can run grub-install /dev/sda and then update-grub. This will rescan the disks for all OSes.
Ubuntu overwrites grub, no boot option encrypted debian
1,581,905,517,000
While installing CentOS 7, i put password for disk encrypt. Now while working remotely on that machine and doing reboot it always ask password to be inserted on-site. Is this normal? or there is a way still keep disk encrypted but make the reboot work?
It is very normal, and it is because disk is in list of disks to be automatically mounted. If you don't want to be asked for password, you should remove encrypted disk from /etc/fstab. After doing this, you will be prompted for password only when you want to mount encrypted disk. Good luck!
CentOS 7 - while installing i set disk encrypted with password, but on reboot always it asking password
1,581,905,517,000
I'm in the process of setting up a FreeBSD 10 server on a KVM vserver. I'm really new to FreeBSD in general (coming from Debian Linux). I installed the system choosing ZFS with encrypted root volume and encrypted swap. I chose this solution to protect my files (Emails, Filesharing, etc.) from outside access. I then re...
Is there a sane solution that I'm missing that would make it possible to encrypt only certain parts of the base system (to be able to boot without VNC and enter the passphrase via SSH)? There are lots of ways to encrypt files. PEFS might be what you want. Is the whole idea of encrypting on a server stupid (since th...
FreeBSD 10 and ZFS: Methods for encrypting files
1,401,572,875,000
I've been trying to string together the right flags in cryptsetup: cryptsetup -y -h sha512 -c twofish-xts-plain64 -s 512 luksFormat /dev/sdx But it hasn't been working. When I enter the command listed above, nothing happens; it doesn't even prompt me for a password. Trying this command with aes-xts-plain64 doesn't w...
With a little help from reddit, I've figured it out. tcplay did the trick. It encrypted my USB flash drive with the following command: tcplay -c -d /dev/sdx -a SHA512 -b TWOFISH-256-XTS tcplay is essentially a TrueCrypt clone. It's available in the Ubuntu repositories. -c tells tcplay to create a new volume. -d spec...
How do you encrypt a USB drive partition with the Twofish cipher and SHA-512 hash without using TrueCrypt? [closed]
1,401,572,875,000
Last night there was a power outage and now my computer will not boot up. After pushing the power button and seeing the BIOS I only see a black screen with a white cursor at the top left of the screen. I plugged in an external hard drive and put in my live CD hoping I could use the live CD to copy my files from my hom...
Try to open a terminal. sudo passwd root Then su You are root now. You can use chmod 755 to modify the permission.
How to get my files from my encrypted home folder on Ubuntu 12.04?
1,401,572,875,000
On Debian LAMP with different PHP based CMSs I use the MTA sSMTP to send email via an email proxy (Gmail); the emails I send are only contact-form inputs transferred from any such CMS to my own email account: CMS contact-form input → Eail proxy (Gmail) → Main email account I use (also Gmail) My sSMTP conf looks simi...
ssmtp has to use your login and password to send the mail. If it would be encrypted, ssmtp would have to decrypt it, so the hacker could do the same. The file /etc/ssmtp/ssmtp.conf should have only the necessary permissions to allow ssmtp to access the file and you should secure your system to prevent unauthorized acc...
Protecting an email-proxy (Gmail) account being used by a Mail Transfer Agent (MTA)
1,401,572,875,000
I have a specific question about OpenSSL's enc command, but I suppose it applies more generally to Unix/Linux file permissions. I have a bash script which has the following decrypt command: openssl enc -d -aes-256-cbc -in secret.enc -out secret -pass file:./pass.bin I understand if the file permission for pass.bin is...
The fact that this happens to be an OpenSSL command is not important. The script is not readable by anyone but the owner (and root, let's not forget that). This means that a non-owner can't execute it as ./script.sh or run it with e.g. bash script.sh. Had the script been readable, a non-owner would be able to run it,...
Unix File Permissions and Decryption with OpenSSL's enc command
1,401,572,875,000
I ran across an example pair where there was an original and a 'flip' version: Original rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" user@<source>:<source_dir> <dest_dir> "Flip" rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" ...
The original author did a sloppy write-up and then you omitted part of what he wrote. He wrote: rsync ... user@<source>:<source_dir> <dest_dir> rsync ... [source_dir] [dest_host:/dest_dir] but it would have been better to write: rsync ... user@<source_host>:<source_dir> <dest_dir> rsync ... <source_dir> user@<dest_...
rsync 'flip' characterization [closed]
1,401,572,875,000
Does PGPDesktop support OpenBSD or e.g. Fedora, or can I only encrypt my whole hard drive when I use Windows?
If you really want to encrypt a disk under OpenBSD, this can help.
Does PGPDesktop supports OpenBSD or e.g. Fedora?
1,401,572,875,000
How can I install GnuPG on my CentOS 7 system? I want to use GnuPG alongside Thunderbird and Enigmail to manage pgp keys, as per the instructions in this link. The problem is that the download instructions I find for linux all have to do with Debian. Here is an example. EDIT typing which gpg resulted in /usr/b...
install Enigmail Thunderbird > Add-ons Menu > Enigmail If you do not already have a PGP key, generate one: gpg --gen-key (follow its prompts to complete the process; default values are generally fine) 3. Restart Thunderbird. Enigmail will probably auto-detect the presence of your GnuPG keychain and use it. If it...
installing GnuGPG with Thunderbird on CentOS 7
1,401,572,875,000
I am trying to encrypt a test file I have and decrypt the file using a bash script. I searched online and found I can use openssl and salt to do this. I found the following code online: FNAME=$1 if [[ -z "$FNAME" ]]; then echo "cryptde <name of file>" echo " - cryptde is a script to decrypt des3 encrypted fi...
FNAME=$1 This assigns the first parameter to FNAME if [[ -z "$FNAME" ]]; then If the string $FNAME is zero in length, then echo the help output and exit openssl des3 -d -salt -in "$FNAME" -out "${FNAME%.[^.]*}" This line runs the openssl command's des3 module (man des3) takes $FNAME as input file name, then writ...
How to encrypt a file using Bash?
1,401,572,875,000
I've never encrypted files in my Linux distribution. Now I need to do that. I'm on Arch. I went to the documentation, it says that support of TrueCrypt is discontinued and after examining other libraries there I decided to use dm-crypt. But I can't figure out how to simply encrypt a file with it. It requires creating...
dm-crypt is a transparent disk encryption subsystem. That being said, it's better suited to encrypt disks and partitions. It can encrypt files, but they have to be mapped as devices for this to work. If you want to encrypt only one file, GnuPG could be a better tool. Example: gpg -c filename See Also: nixCraft: Lin...
How can I encrypt a file with dm-crypt? [closed]
1,328,417,304,000
I'm having trouble with escaping characters in bash. I'd like to escape single and double quotes while running a command under a different user. For the purposes of this question let's say I want to echo the following on the screen: 'single quote phrase' "double quote phrase" How can I escape all the special chars, i...
You can use the following string literal syntax: > echo $'\'single quote phrase\' "double quote phrase"' 'single quote phrase' "double quote phrase" From man bash Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ...
How to escape quotes in the bash shell?
1,328,417,304,000
Are you literally "ending a file" by inputting this escape sequence, i.e. is the interactive shell session is seen as a real file stream by the shell, like any other file stream? If so, which file? Or, is the Ctrl+D signal just a placeholder which means "the user has finished providing input and you may terminate"?
The ^D character (also known as \04 or 0x4, END OF TRANSMISSION in Unicode) is the default value for the eof special control character parameter of the terminal or pseudo-terminal driver in the kernel (more precisely of the tty line discipline attached to the serial or pseudo-tty device). That's the c_cc[VEOF] of the ...
Why does Ctrl-D (EOF) exit the shell?
1,328,417,304,000
You should never paste from web to your terminal. Instead, you should paste to your text editor, check the command and then paste to the terminal. That's OK, but what if Vim is my text editor? Could one forge a content that switches Vim to command mode and executes the malicious command?
Short answer: In many situations, Vim is vulnerable to this kind of attack (when pasting text in Insert mode). Proof of concept Using the linked article as a starting point, I was able to quickly create a web page with the following code, using HTML span elements and CSS to hide the middle part of the text so that onl...
Is Vim immune to copy-paste attack?
1,328,417,304,000
I can use the "script" command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with "col -b", but I can't find a simple way to remove the colour codes. Note that I want to use the command line in th...
The following script should filter out all ANSI/VT100/xterm control sequences for (based on ctlseqs). Minimally tested, please report any under- or over-match. #!/usr/bin/env perl ## uncolor — remove terminal escape sequences such as color changes while (<>) { s/ \e[ #%()*+\-.\/]. | \e\[ [ -?]* [@-~] | # CS...
Removing control chars (including console codes / colours) from script output
1,328,417,304,000
For example: "\e[1;5C" "\e[Z" "\e-1\C-i" I only know bits and pieces, like \e stands for escape and C- for Ctrl, but what are these numbers (1) and letters (Z)? What are the ;, [ and - signs for? Is there only trial and error, or is there a complete list of bash key codes and an explanation of their syntax?
Those are sequences of characters sent by your terminal when you press a given key. Nothing to do with bash or readline per se, but you'll want to know what sequence of characters a given key or key combination sends if you want to configure readline to do something upon a given key press. When you press the A key, ge...
Where do I find a list of terminal key codes to remap shortcuts in bash?
1,328,417,304,000
Whenever I'm at the console login, I press up arrow intentionally to see the previously typed commands. But I see this ^[[A. But when I press Ctrl Alt Print Screen Scroll Lock Pause Break Page Up Page Down Win keys doesn't echo any characters. What might be the reason behind? Does ^[[A sort of characters imply anythin...
Keyboards send events to the computer. An event says “scan code nnn down” or “scan code nnn up”. At the other end of the chain, applications running in a terminal expect input in the form of a sequence of characters. (Unless they've requested raw access, like the X server does.) When you press A, the keyboard sends th...
Is there any reason why I get ^[[A when I press up arrow at the console login screen?
1,328,417,304,000
When we use clear command or Ctrl+L in terminal, it clears terminal but we can still scroll back to view the last used commands. Is there a way to completely clear the terminal?
You can use tput reset. Besides reset and tput reset you can use following shell script. #!/bin/sh echo -e \\033c This sends control characters Esc-C to the console which resets the terminal. Google Keywords: Linux Console Control Sequences man console_codes says: The sequence ESC c causes a terminal reset, which i...
How do I clear the Gnome terminal history?
1,328,417,304,000
I sometime want to pipe the color-coded output fror a process, eg. grep... but when I pipe it to another process, eg. sed, the color codes are lost... Is the some way to keep thes codes intact ? Here is an example which loses the colored output: echo barney | grep barney | sed -n 1,$\ p
Many programs that generate colored output detect if they're writing to a TTY, and switch off colors if they aren't. This is because color codes are annoying when you only want to capture the text, so they try to "do the right thing" automatically. The simplest way to capture color output from a program like that is t...
Where do my ANSI escape codes go when I pipe to another process? Can I keep them?
1,328,417,304,000
Whenever I use a pager like less or an editor like nano in the shell (my shell is GNU bash), I see a behaviour I cannot explain completely and which differs to the behaviour I can observe with other tools like cat or ls. I would like to ask how this behaviour comes about. The —not easy to explain— behaviour is that n...
There are two worldviews here: As far as programs using termcap/terminfo are concerned, your terminal potentially has two modes: cursor addressing mode and scrolling mode. The latter is the normal mode, and a program switches to cursor addressing mode when it needs to move the cursor around the screen by row and col...
How do some tools (e.g. nano , less) manage to leave no content in terminals after exit? [duplicate]
1,328,417,304,000
For example, I have a output: Hello, this is the output. (let's say that for example hello is colored red, and the is colored green, and output is colored purple). Now, let's say that this is the output of a command named x. If I use this command, the output becomes white: x | grep hello I've read that one could us...
You could do this, x | grep --color=never hello To quickly test it, you can do, ls -l /etc/ --color=always | grep --color=never .
How do I use grep while keeping the original text color? [duplicate]
1,328,417,304,000
I've been given this one-liner to know how much memory my processes consume. $ ps -u $USER -o pid,rss,command | \ awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}' Now I'd like to create an alias for that command, but have an issue escaping ' characters: $ alias mm=ps -u $USER -o pid,rss,command | \ ...
To make this an alias, which is possible, you need to use double quotes around the entire value for the alias. You'll also need to escape a few things within the alias as a result, and you need to escape any of the field arguments to awk since these will get interpreted as arguments by Bash as well when you're setting...
How to escape single quotes correctly creating an alias [duplicate]
1,328,417,304,000
I have seen in some screen-shots (can't remember where on the web) that the terminal can display the [username@machine /]$ in bold letters. I'm looking forward to getting this too because I always find myself scrolling through long outputs to find out with difficulty the first line after my command. How can I make the...
You should be able to do this by setting the PS1 prompt variable in your ~/.bashrc file like this: PS1='[\u@\h \w]\$ ' To make it colored (and possibly bold - this depends on whether your terminal emulator has enabled it) you need to add escape color codes: PS1='\[\e[1;91m\][\u@\h \w]\$\[\e[0m\] ' Here, everything n...
How to make the terminal display user@machine in bold letters?
1,328,417,304,000
I want to use printf to print a variable. It might be possible that this variable contains a % percent sign. Minimal example: $ TEST="contains % percent" $ echo "${TEST}" contains % percent $ printf "${TEST}\n" bash: printf: `p': invalid format character contains $ (echo provides the desired output.)
Use printf in its normal form: printf '%s\n' "${TEST}" From man printf: SYNOPSIS printf FORMAT [ARGUMENT]... You should never pass a variable to the FORMAT string as it may lead to errors and security vulnerabilities. Btw: if you want to have % sign as part of the FORMAT, you need to enter %%, e.g.: $ printf '%d...
Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"
1,328,417,304,000
Reading the details of CVE-2009-4487 (which is about the danger of escape sequences in log files) I am a bit surprised. To quote CVE-2009-4487: nginx 0.7.64 writes data to a log file without sanitizing non-printable characters, which might allow remote attackers to modify a window's title, or possibly execute arbitra...
VT100 terminals (which all modern terminal emulators emulate to some extent) supported a number of problematic commands, but modern emulators or distributions disable the more problematic and less useful ones. Here's a non-exhaustive list of potentially risky escape sequences (not including the ones that merely make t...
How to avoid escape sequence attacks in terminals?
1,328,417,304,000
To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch where the found pattern has a different background. I attempted to run man -P vim systemd but...
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The differe...
Make Less highlight search patterns instead of italicizing them
1,328,417,304,000
When I use less at the command line the output is like but when I use less from within a bash script I get: How can I use less in a bash script and not get all the escape characters and have it work like it does at the interactive command line?
Use -R flag: -r or --raw-control-chars Causes "raw" control characters to be displayed. The default is to display control characters using the caret notation; for example, a control-A (octal 001) is displayed as "^A". Warning: when the -r option is used, less cannot keep track of the actual appearance of the ...
How to use less in a script without getting ESC escape characters?
1,328,417,304,000
Can't figure out how to escape everything while using awk. I need to enclose each input string with with single quotes, e.g. input string1 string2 string3 output 'string1' 'string2' 'string3' Been fighting with escaping ' " $0 and everything else and I just cannot make it work. Either $0 is passed to bash directly,...
Here are a couple of ways: use octal escape sequences. On ASCII-based systems where ' is encoded as byte 39 (octal 047), that would be: awk '{print "\047" $0 "\047"}' input 'string1' 'string2' 'string3' pass the quote as a variable $ awk -v q="'" '{print q $0 q}' input 'string1' 'string2' 'string3'
awk print apostrophe/single quote
1,328,417,304,000
I just noticed that it seems like the flag -e does not exist for the echo command in my shell on Linux. Is this just a messed up setting or is it "normal"? Some code as an example: #!/bin/sh echo -e "\e[3;12r\e[3H" Prints: -e \e[3;12r\e[3H This worked before! I guess some stty commands went terribly wrong and now it...
Because you used sh, not bash, then echo command in sh doesn't have option -e. From sh manpage: echo [-n] args... Print the arguments on the standard output, separated by spaces. Unless the -n option is present, a newline is output following the arguments. And it doesn't have \e, t...
Escape sequences with "echo -e" in different shells
1,328,417,304,000
I was reading this message from the zsh mailing list about key bindings and I'd like to know which key I need to press: ^X^I (I think Ctrl-X Ctrl-I, the capital X and I) ^[^@ (I think Ctrl-Esc-@ ??) ^X^[q(I think Ctrl-X Esc-q ??) ^XQ (I think Ctrl-X and Q ??) From the Archlinux wiki page on zsh ^[[1;3A ^[[1;3D Fr...
^c is a common notation for Ctrl+c where c is a (uppercase) letter or one of @[\]^_. It designates the corresponding control character. The correspondence is that the numeric code of the control character is the numeric code of the printable character (letter or punctuation symbol) minus 64, which corresponds to setti...
What does the ^ character mean in sequences like ^X^I?
1,328,417,304,000
I would like to output this on completion of my bash script. /\_/\ ( o.o ) > ^ < I have tried the following but all return errors. echo /\\_/\\\n\( o.o \)\n > ^ < echo \/\\_\/\\\r\n( o.o )\r\n > ^ < echo /\\_/\\\n\( o.o \)\n \> ^ < How do I escape these characters so that bash renders them as a string?
In this case, I'd use cat with a (quoted) here-document: cat <<'END_CAT' /\_/\ ( o.o ) > ^ < END_CAT This is the best way of ensuring the ASCII art is outputted the way it is intended without the shell "getting in the way" (expanding variables etc., interpreting backslash escape sequences, or doing redirections, pi...
How do you output a multi-line string that includes slashes and other special characters?
1,328,417,304,000
Apologies if this has already been asked, but I have no idea how I can find this out myself - when I search for "^[[A" in any search engine it ignores the "^[[" part altogether. Anyway, my question: Sometimes in terminal (on a Mac) when I hit the arrow keys, the characters "^[[A", "^[[B", "^[[C" or "^[[D" appear. I se...
These are ANSI escape codes. The ^[ represents an ESC (escape) character, the next [ is an actual left square bracket, and the letter indicates the function of the escape code. The Esc[ part is called the CSI (Control Sequence Introducer). So the sequence CSI A means arrow up, or CUU (CUrsor Up). Anyway, this scheme ...
Caret square bracket square bracket A ^[[A - What does it mean?
1,328,417,304,000
Gilles wrote: character 27 = 033 = 0x1b = ^[ = \e Demizey wrote: ^[ is just a representation of ESCAPE and \e is interpreted as an actual ESCAPE character Then I also found this line from a TechRepublic article Make sure you write the key sequence as \e[24~ rather than ^[[24~. This is because the ^[ sequence is e...
If you take a look at the ANSI ASCII standard, the lower part of the character set (the first 32) are reserved "control characters" (sometimes referred to as "escape sequences"). These are things like the NUL character, Life Feed, Carriage Return, Tab, Bell, etc. The vast majority can be emulated by pressing the Ctrl ...
The difference between \e and ^[
1,328,417,304,000
There are many questions on SE that show how to recover from terminal broken by cat /dev/urandom. For those that are unfamiliar with this issue - here what it is about: You execute cat /dev/urandom or equivalent (for example, cat binary_file.dat). Garbage is printed. That would be okay... except your terminal continu...
No: there is no standard way to "disable it", and the details of breakage are actually terminal-specific, but there are some commonly-implemented features for which you can get misbehavior. For commonly-implemented features, look to the VT100-style alternate character set, which is activated by ^N and ^O (enable/dis...
How to prevent random console output from breaking the terminal?
1,328,417,304,000
tput civis successfully hides the cursor. tput cvvis should unhide it, but it doesn't. Any idea what the problem might be?
In the ncurses terminal database, cvvis is used as documented in the terminfo manual page: cursor_visible cvvis vs make cursor very visible and if there is no difference between normal and very visible, the cvvis capability is usually omitted. The feature is ...
Hide and unhide cursor with tput
1,328,417,304,000
I know that, if a coloured terminal is available, one can colour the output of it using escape characters. But is there a possibility to find out, which colour the output is currently being displayed as? Or better, what colour the text would be, if I would output it right now? I'm asking to not break any previous colo...
In general, obtaining the current colours is impossible. The control sequence processing of a terminal happens "inside" the terminal, wherever that happens to be. With a terminal emulator such as xterm or the one built into an operating system kernel that provides the kernel virtual terminals, the internal state of ...
How to determine the current color of the console output?
1,328,417,304,000
Why bother? Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer is cleared, I can just scroll to top, and will be done. Some considerations: There is clear command, according to man, ...
From the man bash's readline section: clear-display (M-C-l) Clear the screen and, if possible, the terminal's scrollback buffer, then redraw the current line, leaving the current line at the top of the screen. clear-screen (C-l) Clear the screen, then redraw the current line, le...
The easiest way to clear scrollback buffer of terminal + some deeper explanation?
1,328,417,304,000
In people's '.*rc' files I see online or in various code, I tend to see a lot of people who manually use ANSI escape sequences instead of using tput. I had the understanding that tput is more universal/safe, so this makes me wonder: Is there any objective reason one should use escape sequences in place of tput? (Port...
tput can handle expressions (for instance in sgr and setaf) which the typical shell-scripter would find less than usable. To get an idea of what is involved, see the output from infocmp with the -f (formatting) option applied. Here is one of examples using those strings from xterm's terminfo descriptions: xterm-16co...
Is there any objective benefit to escape sequences over tput?
1,328,417,304,000
I want to count how many times a certain sequence of bytes happens inside a file that I have. For example, I want to find out how many times the number \0xdeadbeef occurs inside an executable file. Right now I am doing that using grep: #/usr/bin/fish grep -c \Xef\Xbe\Xad\Xde my_executable_file (The bytes are written ...
This is the one-liner solution requested (for recent shells that have "process substitution"): grep -o "ef be ad de" <(hexdump -v -e '/1 "%02x "' infile.bin) | wc -l If no "process substitution" <(…) is available, just use grep as a filter: hexdump -v -e '/1 "%02x "' infile.bin | grep -o "ef be ad de" | wc -l Below...
How can I count the number of times a byte sequence occurs in a file?
1,328,417,304,000
I know that we can escape a special character like *(){}$ with \ so as to be considered literals. For example \* or \$ But in case of . I have to do it twice, like \\. otherwise it is considered special character. Example: man gcc | grep \\. Why is it so?
Generally, you only have to escape one time to make special character considered literal. Sometime you have to do it twice, because your pattern is used by more than one program. Let's discuss your example: man gcc | grep \\. This command is interpreted by two programs, the bash interpreter and grep. The first escape...
Why do I have to escape a "dot" twice?
1,328,417,304,000
In .bashrc case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac I understand ${debian_chroot:+($debian_chroot)}\u@\h: \w, but not \[\e]0;. What does it make?
The \e]0; is an escape sequence; \e is replaced with ASCII 27 (ESC), so the terminal receives the 4 characters ESC ] 0 ; tells xterm to set icon and title bar, that ends in BEL (\a). So the sequence \e]0;STUFFGOESHERE\a will set the title of the terminal to STUFFGOESHERE. In your example it'll set the title to user...
Meaning of \[\e]0; in PS1 in .bashrc
1,328,417,304,000
I have a shell script that uses the following to print a green checkmark in its output: col_green="\e[32;01m" col_reset="\e[39;49;00m" echo -e "Done ${col_green}✓${col_reset}" After reading about Bash's ANSI-C Quoting, I realized I could use it when setting my color variables and remove the -e flag from my echo. col...
$'…' is a ksh93 feature that is also present in zsh, bash, mksh, FreeBSD sh and in some builds of BusyBox sh (BusyBox ash built with ENABLE_ASH_BASH_COMPAT). It isn't present in the POSIX sh language yet. Common Bourne-like shells that don't have it include dash (which is /bin/sh by default on Ubuntu among others), ks...
Which shells support ANSI-C quoting? e.g. $'string'
1,328,417,304,000
I'm printing a message in a Bash script, and I want to colourise a portion of it; for example, #!/bin/bash normal='\e[0m' yellow='\e[33m' cat <<- EOF ${yellow}Warning:${normal} This script repo is currently located in: [ more messages... ] EOF But when I run in the terminal (tmux inside gnome-terminal) the A...
In your script, these assignments normal='\e[0m' yellow='\e[33m' put those characters literally into the variables, i.e., \e[0m, rather than the escape sequence. You can construct an escape character using printf (or some versions of echo), e.g., normal=$(printf '\033[0m') yellow=$(printf '\033[33m') but you would ...
Is it possible to use ANSI color escape codes in Bash here-documents?