Know if Windows is Activated from the CLI
Open a terminal and type:
slmgr /xpr
7-Zip - a file archiver with high compression ratio (manual)
Copyright (c) 1999-2019 Igor Pavlov
The documentation for 7-Zip includes:
General information about 7-Zip
User's Guide for 7-Zip File Manager
User's Guide for command line version
See Also
Frequently Asked Questions (FAQ)
How-to give administartion privileges (root) on Ubuntu from CLI
In Ubuntu, the root account is disabled (root password is not set). On normal Ubuntu Linux computers you need to use sudo to act as root.
The two best advantages about sudo:
Restricted privileges
Logs actions taken by users
To use sudo first configure its file located at /etc/sudoers.
This file should only be edited with the visudo command.
In the sudoers file almost all lines are commented out, the one that matters the most is:
root ALL=(ALL) ALL
This line means:
root user can execute from ALL terminals, acting as ALL (any) users, and run ALL (any) command.
FIRST part is the user,
SECOND the terminal from where the user can use sudo,
THIRD part is which users he may act as sudo,
LAST one, is which commands he may run when using sudo.
Example:
operator ALL= /sbin/poweroff
The above command, makes the user operator can from any terminal, run the command power off.
You can also create aliases for users:
users -> User_Alias, run commands as other users -> Runas_Alias, host -> Host_Alias and command -> Cmnd_Alias
So, a typical sudoers file may look like this:
User_Alias OPERATORS = joe, mike, judeRunas_Alias
OP = root, operatorHost_Alias
OFNET = 10.1.2.0/255.255.255.0
Cmnd_Alias PRINTING = /usr/sbin/lpc, /usr/bin/lprm
#Users in OPERATORS group can run ANY command from ANY terminal
OPERATORS ALL=ALL
# User linus can run ANY command from ANY terminal as any user in the OP group (root or operator)
linus ALL=(OP) ALL
# User user2 ANY command from ANY machine in the OFNET network, as any user
user2 OFNET=(ALL) ALL
# User user3 CAN run lpc and lprm from ANY machine
user3 ALL= PRINTING
# User go2linux ANY command from ANY machine acting as any user (like in Ubuntu) WITH NO password ASKED FOR
go2linux ALL=(ALL) NOPASSWD: ALL
visudo command uses vi as editor
Tips to use it:
Switch to root, (su root), then run visudo, (as above).
Find where it says "root ALL=(ALL) ALL".
Type "o" to insert a new line below it.
Now type what you want to insert, eg "username ALL=(ALL) ALL".
Hit esc to exit insert-mode.
Type ":x" to save and exit.
Changing the default visudo editor
Using vim with visudo
export VISUAL=vim; visudo
Using nano with visudo
export VISUAL=nano; visudo
Furter readings:
https://www.linux.com/tutorials/configuring-linux-sudoers-file/
https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos
https://www.lifewire.com/create-users-useradd-command-3572157
How-to set or change timezone on Ubuntu 18-04 from CLI
Both of the next commands will show the configured Time Zone on the system:
timedatectl
ls -l /etc/localtime
Type this command to list the Time Zones, in the mean time find the desire one from the list:
timedatectl list-timezones
To set the desired Time Zones, type (substituting your_time_zone with the desired Time Zone):
sudo timedatectl set-timezone your_time_zone
To set your the system to synchronize ttime with the NIST atomic clock::
timedatectl set–ntp yes
To disable time synchronization with the NIST atomic clock:
timedatectl set–ntp no
The last command will require to adjust time manually!
How-to set or change time format displayed on Ubuntu like systems
This website will show the string necesary to display Time and calendar date on different formats on Linux systems desktop clock.
And allows us to build a custom format with a drag and drop interface.
Plus, it shows a refrence where you can see which string character shows which value.
Examples:
To see this format: Use this string:
09/09/1909 09:09:09 PM %e/%b/%Y %H:%M:%S %p
09 09 1909 09:09:09PM %e %b %Y %H:%M:%S%p
And so on ...
Login as root.
See a list of logged in user with
who or w command:
Use pkill command.
Syntax is:
pkill -KILL -u user
Warning:
Do not kill root user or other system level user process.
Do not run the pkill for root user!
To Boot Linux, find and delete pagefile and hiberfile on Windows systems in one step:
Just use this hasty created script:
#!/bin/bash
#
# To Identify the Microsoft Windows System Drive
# and
# REMOVE hiberfile.sys
#
rm -rfv /$(ls /sda[1-2]/[Ww]indows/[Ss]ystem32/ntoskrnl.exe | tr ^/ " " | awk {'print $1'})/hiberfil.sys
# To Identify the Microsoft Windows System Drive
# and
# REMOVE pagefile.sys
#
rm -rfv /$(ls /sda[1-2]/[Ww]indows/[Ss]ystem32/ntoskrnl.exe | tr ^/ " " | awk {'print $1'})/pagefile.sys
Understanding Beep Codes on a Dell Desktop PC
Published at https://hiberhernandez.blogspot.com/
Tras instalar Lubuntu 14.04 LTS ...
Published at http://trastetes.blogspot.com
Author: Luis Cordero | Date: 29 de abril de 2014
In Spanish! Good details to have in account after installing an ubuntu based computer system.
How do I find the UUID (and LABEL) of a filesystem
Use the command 'blkid' (part of e2fsprogs package)...
To look up data on /dev/sda1:
~$ sudo blkid /dev/sda1
/dev/sda1: UUID="727cac18-044b-4504-87f1-a5aefa774bda" TYPE="ext3"
Show UUID data for all partitions:
~$ sudo blkid
/dev/sda1: UUID="727cac18-044b-4504-87f1-a5aefa774bda" TYPE="ext3"
/dev/sdb: UUID="467c4aa9-963d-4467-8cd0-d58caaacaff4" TYPE="ext3"
answered May 4 '09 at 19:11
Excellent, I never knew about blkid
I've always just done
ls -l /dev/disk/by-uuid
– AdmiralNemo Mar 27 '12 at 23:48
Using blkid You will see results like this:
~# blkid
/dev/sda2: LABEL="Boot" UUID="e1f44bea-a9b1-47a0-8bbb-f5b3880b5ac3" TYPE="ext2"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/sda1: LABEL="Bios" UUID="2c04ac87-7cd8-4092-aad6-2e5fb87e3b0c" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda3: LABEL="Swap" UUID="d301a6f3-2d67-4bca-a1a8-610cfff82f04" TYPE="swap"
/dev/sda4: LABEL="Root" UUID="acc3ee46-78c6-4eb9-865f-5a5493659d17" TYPE="ext4"
With ls -l /dev/disk/by-label you will see results like this:
~# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Apr 6 08:19 2c04ac87-7cd8-4092-aad6-2e5fb87e3b0c -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 6 08:19 acc3ee46-78c6-4eb9-865f-5a5493659d17 -> ../../sda4
lrwxrwxrwx 1 root root 10 Apr 6 08:47 d301a6f3-2d67-4bca-a1a8-610cfff82f04 -> ../../sda3
lrwxrwxrwx 1 root root 10 Apr 6 08:19 e1f44bea-a9b1-47a0-8bbb-f5b3880b5ac3 -> ../../sda2
AND in fact, you can see the file system label too, using ls -l /dev/disk/by-label:
~# ls -l /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 Apr 6 08:19 Bios -> ../../sda1
lrwxrwxrwx 1 root root 10 Apr 6 08:19 Boot -> ../../sda2
lrwxrwxrwx 1 root root 10 Apr 6 08:19 Root -> ../../sda4
lrwxrwxrwx 1 root root 10 Apr 6 08:47 Swap -> ../../sda3
Note: Remember that YMMV
-by: one_more_tester | Date: Wednesday, April 6, 2016
Install Google Earth in Ubuntu 14.04 64bit
Published at http://www.webupd8.org
Author: Andrew | Date: Friday, April 25, 2014
Playing DVD's with RestrictedFormats
Install the libdvdread4 package
sudo apt-get install libdvdread4
Run the install-css.sh script
sudo /usr/share/doc/libdvdread4/install-css.sh
Rebooting may be necessary. After this, VLC will automatically use it.
How to kill all processes instances with one command in Linux
To kill a process you have to provide the process id to the "kill" command.
I have an oracle instance running with the name "oraxpo". First find all running processes where the term "oraxpo" is used in the process name.
$ ps -ef | grep oraxpo
oracle 4663 1 0 18:18 ? 00:00:00 ora_pmon_oraxpo
oracle 4665 1 0 18:18 ? 00:00:00 ora_psp0_oraxpo
oracle 4667 1 0 18:18 ? 00:00:01 ora_mman_oraxpo
oracle 4669 1 0 18:18 ? 00:00:00 ora_dbw0_oraxpo
oracle 4671 1 0 18:18 ? 00:00:03 ora_lgwr_oraxpo
oracle 4673 1 0 18:18 ? 00:00:02 ora_ckpt_oraxpo
oracle 4675 1 1 18:18 ? 00:00:11 ora_smon_oraxpo
oracle 4677 1 0 18:18 ? 00:00:00 ora_reco_oraxpo
oracle 4679 1 0 18:18 ? 00:00:01 ora_cjq0_oraxpo
oracle 4681 1 0 18:18 ? 00:00:06 ora_mmon_oraxpo
oracle 4683 1 0 18:18 ? 00:00:01 ora_mmnl_oraxpo
oracle 4685 1 0 18:18 ? 00:00:00 ora_d000_oraxpo
oracle 4687 1 0 18:18 ? 00:00:01 ora_d001_oraxpo
oracle 4689 1 0 18:18 ? 00:00:00 ora_d002_oraxpo
oracle 4691 1 0 18:18 ? 00:00:06 ora_s000_oraxpo
oracle 4713 1 0 18:18 ? 00:00:00 ora_arc0_oraxpo
oracle 4715 1 0 18:18 ? 00:00:02 ora_arc1_oraxpo
oracle 7674 4613 0 18:32 pts/1 00:00:00 grep oraxpo
Now to kill a process we need to provide the process id which are shown in the second column of above output. The following command kills the process with the id 4663 which is the Oracle background process PMON.
$ kill -9 4663
This way we can kill all process but the problem is that we will have to provide all process id's to the "kill -9" command separated with a space. e.g. to kill first three process we will use "kill -9 4663 4665 4667". Or we can come up with a way where all process id's for oraxpo should be passed to kill -9 automatically.
The following command prints the second column in the output of processes which contains oraxpo in their name.
$ ps -ef | grep oraxpo | grep -v grep | awk '{print $2}'
4665
4667
4669
4671
4673
4675
4677
4679
4681
4683
4685
4687
4689
4691
4713
4715
Now all we need to do is to pass the result of this command to "kill -9".
$ kill -9 `ps -ef | grep oraxpo | grep -v grep | awk '{print $2}'`
NOTE: Please don't try this unless you have tried every thing else and there is no way else left then killing oracle like this.
After we execute this command let's see if we still have any process containing oraxpo in their name.
$ ps -ef | grep oraxpo
oracle 7804 4613 0 18:36 pts/1 00:00:00 grep oraxpo
As can be seen from the output above there is no oracle process running.
How to EASY extract URL's from HTML or XML using command line
With the answer at stackoverflow.com by Ingo Karkat:
With the Xidel - HTML/XML data extraction tool, this can be done via:
$ xidel --extract "//a/@href" http://example.com/
With conversion to absolute URLs:
$ xidel --extract "//a/concat(resolve-uri(@href, base-uri()))" http://example.com/
AND to make it EASY, create a script how accepts the web page as an argument
Create a text file with this content:
#!/bin/bash
xidel --extract "//a/concat(resolve-uri(@href, base-uri()))" $1
Give it a nice name and execution permitions:
chmod +x extract_urls.sh
Use it like this:
$ ./extract_urls.sh http://example.com/
*You may need to install:
xidel (from http://videlibri.sourceforge.net/xidel.html)
libssl-dev
libssl-doc{a}
zlib1g-dev{a}
Encode video to MP4 with Avidemux
See the posting from shaema (17th Apr 2011 03:43 #4 )
For MP4 output I suggest:
1 - In the Video dropdown list on the top left select MPEG-4 AVC.
2 - Click [Configure] button, a new x264 configuration window opens up. Select Average Bitrate (Two Pass) from the dropdown list, and set the Average Bitrate to 10000
3 - Click OK in the buttom of the screen to close the window
4 - In the Audio dropdown list select MP3(lame)
5 - Click on [Filters] button and set Resampling at 48000 then click OK
6- In the Format dropdown list select MP4
Now save the file by typing Ctrl-S or File-Save-Save Video and type a file name with extension of .mp4
I have always had good results from the above steps, bearing in mind that you do need a poweful PC to do the encoding.
You could experiment with the Average Bitrate; a higher value means better quality.
Solve "badsig error" in Ubuntu
To remove the bad signature error, open the terminal and use the commands given below one by one:
sudo apt-get clean cd /var/lib/apt sudo mv lists lists.old sudo mkdir -p lists/partial sudo apt-get clean sudo apt-get update
Find the offending line in
/etc/apt/source.list
/etc/apt/source.list.d/ [see each of the lists content]
Edit the list adding a # sing in front of the offending line, update && upgrade and uncomment the offending line.
Network Manager not running error on Ubuntu 12.04 (FIXED)
Open your terminal, type:
sudo gedit /etc/network/interfaces
And remove those lines that come AFTER iface lo inet loopback:
auto eth0 iface eth0 inet dhcp
Your /etc/network/interfaces file should said:
auto lo iface lo inet loopback
Make sure to save the file before you close anything. Reboot the system.
The problem was each time you start your computer, Network Manager try to auto connect using the wired connection as your primary connection instead of the wireless connection.
This solution work if you are getting that error message about:
"waiting up to 60 seconds more for network configuration..."
Print on both sides on a Xerox 4595
Choose two sided print "Flip [Short/Long] Edge from the "2 Side Print" control.
Convert bin / cue images to an ISO file
The software to convert bin / cue images into an ISO file is called bchunk
The syntax from bchunk is as follows:
bchunk [-v] [-p] [-r] [-w] [-s]
So to convert image.bin and image.cue into image.iso, runthe following command:
bchunk image.bin image.cue image.iso
Then you can mount the ISO...
Mount LOOP devices (ISO, IMG, etc)
in Linux, or lofiadm[6] in SunOS. As an example, if example.img is a regular file containing a filesystem and /home/you/dir is a Linux user's directory, the superuser (root) may mount the file on the directory by executing the following two commands:
losetup /dev/loop0 example.img mount /dev/loop0 /home/you/dir
The mount utility is usually capable of handling the entire procedure:
mount -o loop example.img /home/you/dir
The device can then be unmounted with the following command:
umount /home/you/dir
Or, after finding the associated loop number by e.g.
mount | grep "/home/you/dir"
losetup -a | grep example.img
umount /dev/loop<N>
Vi and Vim Editor: 12 Powerful Find and Replace Examples
Syntax of the text substitution inside vim editor:
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
Following are three possible flags.
[c] Confirm each substitution.
[g] Replace all occurrences in the line.
[i] Ignore case for the pattern.
Example 1. Substitute all occurrences of a text with another text in the whole file
:%s/old-text/new-text/g
%s – specifies all lines. Specifying the range as ‘%’ means do substitution in the entire file.
g – specifies all occurrences in the line. With the ‘g’ flag , you can make the whole line to be substituted.
If this ‘g’ flag is not used then only first occurrence in the line only will be substituted.
Example uses of the Linux Command zip
Create a file "archivefile1.zip" which contains a copy of all files in the current directory: $ zip archivefile1 *
Copy the directory "/home/joe/papers" into "archivefile3.zip": $ zip -r archivefile3 /home/joe/papers
Write the files extracted from "archivefile1.zip" to the current directory: $ unzip archivefile1.zip
[-d exdir] An optional directory to extract files. By default, all files and subdirectories are recreated in the current directory: $ unzip archivefile1.zip -d /tmp/af1
-v Be verbose or print diagnostic version info. This option has evolved and now behaves as both an option and a modifier.
Assign Private Network Address blocks
The private address space specified in RFC 1918 is defined by the following three address blocks:
10.0.0.0/8 - Class A network ID that allows the following range of valid IP addresses: 10.0.0.1 to 10.255.255.254. The 10.0.0.0/8 private network has 24 host bits that can be used for any subnetting scheme within the private organization
172.16.0.0/12 - Can be interpreted either as a block of 16 class B network IDs or as a 20-bit assignable address space (20 host bits) that can be used for any subnetting scheme within the private organization. The 172.16.0.0/12 private network allows the following range of valid IP addresses: 172.16.0.1 to 172.31.255.254
192.168.0.0/16 - Can be interpreted either as a block of 256 class C network IDs or as a 16-bit assignable address space (16 host bits) that can be used for any subnetting scheme within the private organization. The 192.168.0.0/16 private network allows the following range of valid IP addresses: 192.168.0.1 to 192.168.255.254
The result of many organizations using private addresses is that the private address space is re-used, helping to prevent the depletion of public addresses.
How To Fix Offending key in ~/.ssh/known_hosts file
The following error will be displayed when the remote host key changes
(after you’ve connected earlier with a valid remote host key).
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a7:a8:f2:97:94:33:58:b7:9d:bc:e0:a6:6b:f7:0a:29.
Please contact your system administrator.
Add correct host key in /home/ramesh/.ssh/known_hosts to get rid of this message.
Offending key in /home/ramesh/.ssh/known_hosts: 6 <-----Note: Change the 6 according to the line number shown on your message!
Permission denied (publickey,password).
Use the following command to remove the offending key # sed -i '6d' ~/.ssh/known_hosts
Perl solution # perl -pi -e 's/\Q$_// if ($. == 6);' ~/.ssh/known_hosts
Habilitando el autologin en lightdm (LXDE)
Edit /etc/lightdm/lightdm.conf
[Seat:*]
autologin-user=su_usuario
autologin-user-timeout=0
pam-service=lightdm-autologin
FOR SOME REASON Ubuntu 16.04.4 LTS Xenial uses the next file as lightdm.conf
/usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
With the next content to enable Auto-Login:
[Seat:*]
autologin-user=user
autologin-user-timeout=0
greeter-session=lightdm-gtk-greeter
Thanks to Zanna, Wari Murphy, Olorin and SH ShaHad on askubuntu.com
LightDM display manager in Ubuntu
Auto Login on Ubuntu 18.04.2
Use this file:
root@linuxmachine:/# cat /etc/lightdm/lightdm.conf.d/50-usersconfig.conf
With this content:
[Seat:*]
autologin-user=larry
autologin-user-timeout=0
greeter-session=lightdm-gtk-greeter
Change your default ssh keys!!!
Avoid being to vurnerable!!!
1. Remove run levels for SSH by issuing the command:
update-rc.d -f ssh remove
2. Move the default Kali ssh keys to a new folder:
cd /etc/ssh/
mkdir default_keys
mv -v ssh_host_* default_keys/
3. Regenerate the keys:
dpkg-reconfigure openssh-server
4. Verify ssh key hashes are different:
md5sum ssh_host_* > new_keys
Compare new key hashes with the default keys
cd default_keys/ md5sum *
5. Make sure SSH service always restarts on reboot
update-rc.d -f ssh enable 2 3 4 5
7. Test:
Login from remote client
Reboot to confirm ssh service starts on boot
How To Configure ssh login PASSWORDLESS!
The video (in spanish) shows how to configure ssh passwordless!
Here are the simple steps to acomplish this:
1. Login to local and remote computer.
2. Generate the ssh-keys IN BOTH COMPUTERS with the command:
$ ssh-keygen
(the command will prompt for a passprase, remember it!)
3. Verify that the files id_rsa and id_rsa.pub are at the ~/.ssh/ directory.
4. Copy the id_rsa.pub file using SCP like this:
$ scp -P 22 id_rsa.pub user@server-name_or_IP-Address:/home/user
5. Create the file /home/user/.ssh/authorized_keys adding the content of the file id_rsa.pub
$ cat /home/user/id_rsa.pub >> /home/user/.ssh/authorized_keys
6. Logoff the remote computer and login as usual, if you are not prompt for a password you do it GOOD!
Use UFW - Uncomplicated Firewall (tool to handle iptables firewall)
Originally posted by cprofitt; (the link in the title shows the original post)
last edited (by cprofitt) June 9th, 2008 at 09:40 PM
Basic usage
Enable the firewall (with inbound deny all rule) $ sudo ufw default deny && sudo ufw enable
Turn off the firewall $ sudo ufw disable
To add deny rules blocking a port $ sudo ufw deny port <port number>
Blocking an ip address $ sudo ufw deny from <ip address>
Blocking a specific ip address and port $ sudo ufw deny from <ipaddress> to port <port number>
Advanced examples:
Denying access from an ip address range 10.120.0.1 - 10.120.0.255 for SSH port 22 $ sudo ufw deny from 10.0.0.1/24 to any port 22
Allow example from an ip address range 10.120.0.1 - 10.120.0.255 to port 22 $ sudo ufw allow from 10.0.0.0/24 to any port 22
Get the current status of your UFW rules $ sudo ufw status or $ sudo ufw status verbose
To remove a deny/allow rule $ sudo ufw delete <rule type> from <ip address> to any port <port number>
You need to be careful with setting up allow and deny rules that 'intersect', because the first rule matched is applied and the remaining are ignored.
SECNARIO:
Block access to port 22 from 192.168.0.1 and 192.168.0.7, Allow all other 192.168.0.x IPs to have access to port 22
$ sudo ufw deny from 192.168.0.1 to any port 22
$ sudo ufw deny from 192.168.0.7 to any port 22
$ sudo ufw allow from 192.168.0.0/24 to any port 22
If you do the allow statement before either of the deny statements it will be matched first and the deny will not be evaluated.
$ sudo ufw status
To Action From
-- ------ ----
22:tcp DENY192.168.0.1
22:udp DENY192.168.0.1
22:tcp DENY192.168.0.7
22:udp DENY192.168.0.7
22:tcp ALLOW 192.168.0.0/24
22:udp ALLOW 192.168.0.0/24
Allow is at the bottom, will be the last command evaluated. If it appeared above the deny rules, deny rules would not be evaluated.
So ...
To Enable UFW:
ufw enable
To DENY ALL incoming / outgoing comunication:
ufw default deny
To ALLOW comunication to a range of ip's to a port:
ufw allow from 10.0.0.0/24 to any port 22
Info taken from http://ubuntuforums.org/showthread.php?t=823741
(important note: UFW is not the firewall. UFW just configures your iptables)
in most cases I recommend doing the following immediately:
sudo ufw default deny
sudo ufw enable
Then fine tuning can start with some basic commands like:
Turn on the firewall
sudo ufw enable
Turn off the firewall
sudo ufw disable
To add deny rules:
blocking a port
sudo ufw deny port <port number>
blocking an ip address
sudo ufw deny from <ip address>
blocking a specific ip address and port
sudo ufw deny from <ipaddress> to port <port number>
advanced deny example for denying access from an ip address range
10.120.0.1 - 10.120.0.255 for SSH port 22
sudo ufw deny from 10.0.0.1/24 to any port 22
To add allow rules:
to allow an ip address
sudo ufw allow from <ip address>
To allow a port
sudo ufw <port number>
To allow a specific ip address and port
sudo ufw allow from <ipaddress> to any port <port number>
Advanced allow example for allowing access from an ip address range
10.120.0.1 - 10.120.0.255 to port 22
sudo ufw allow from 10.0.0.0/24 to any port 22
To get the current status of your UFW rules
sudo ufw status
To remove a deny or allow rule
sudo ufw delete <rule type> from <ip address> to any port <port number>
(note: you basically match the syntax for the creation of the rule and add 'delete')
You need to be careful with setting up allow and deny rules that 'intersect'
because the first rule matched is applied and the remaining are ignored.
SECNARIO:
You want to block access to port 22 from 192.168.0.1 and 192.168.0.7
but allow all other 192.168.0.x IPs to have access to port 22
sudo ufw deny from 192.168.0.1 to any port 22
sudo ufw deny from 192.168.0.7 to any port 22
sudo ufw allow from 192.168.0.0/24 to any port 22
If you do the statement BEFORE either of the DENY statements
it will be matched first and the deny will not be evaluated.
You can check this by checking ufw status
sudo ufw status
To Action From
-- ------ ----
22:tcp DENY 192.168.0.1
22:udp DENY 192.168.0.1
22:tcp DENY 192.168.0.7
22:udp DENY 192.168.0.7
22:tcp ALLOW 192.168.0.0/24
22:udp ALLOW 192.168.0.0/24
The ALLOW is at the bottom and will be the last command evaluated.
If it appeared above the DENY rules, the deny rules would not be evaluated.
I hope this helps you use ufw to secure your computer.
Link to the documentation wiki
https://help.ubuntu.com/community/UFW
Last edited by cprofitt; June 9th, 2008 at 09:40 PM
Install and Configure ZoneMinder - Linux video camera security and surveillance solution
Official Web Site and Documentation linked to this section title
Video tutorial
Configuring ZoneMinder
Setup apache2 to work with ZoneMinder and restart apache2 # ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf && service apache2 restart
Run the ZoneMinder Web Console visit http://localhost/zm from your ZoneMinder server or http://<server_ip>/zm from a remote computer
Stream Live Audio/Video from webcam and Linux using the CLI or GUI
To set up webcam streaming from GUI, follow the link in the title.
To set up webcam streaming from the command line, you need to use three string values
(explained on the above link, configuring GUI-based streaming).
In this test setup, those string values were:
"MRL":
v4l2:///dev/video0
"Edit options":
:v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300
"Stream output string":
:sout="#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/stream.wmv}"
Concatenate those three strings to contruct arguments for cvlc command. That is, the following command will launch webcam streaming over HTTP in WMV format.
$ cvlc v4l2:///dev/video0 :v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300 :sout="#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/stream.wmv}"
In the above command, specific string values (e.g., audio device name) might be slightly different depending on your hardware configuration. So go through the above GUI-based VLC configuration yourself to find out the correct cvlc arguments for your system.
Unclean NTFS, can't mount ... Fix!
To READ fix this:
Boot Windows and properly shut it down (from CLI)
C:\shutdown /s /f /t 00 NOTE: To do a FULL Shutdown (because Win8-10 kind of Hibernate by default with GUI shutdown)
If you can't boot into Windows, then on Linux (from CLI)
sudo ntfsfix /dev/sdYZ NOTE: YZ = NTFS partition ( sda2 , sdb1 , etc )
sudo mount -o rw /dev/sdYZ NOTE: -o rw is to enable Read/Write permissions to the partition
Read/Write Volume label on command line
To READ partition labels (and other information):
# lsblk -o name,mountpoint,label,size,uuid
To WRITE a label, use one tool for each kind of partition
(read man page for each tool, or follow the link in this section title):
FAT16 and FAT32, use mlabel from the mtools package
NTFS, use ntfslabel from the ntfs-3g package
ext2, ext3, or ext4, use e2label
JFS, use jfs_tune
ReiserFS (v3), use reiserfstune
XFS, use xfs_admin
Start a GUI Application on a Remote Computer using SSH
Log into a remote machine using SSH
$ ssh 192.168.1.100
Check wich is the local display for the remote machine
echo $DISPLAY
Then tell GUI applications to launch on the local screen and be displayed on the remote computer's screen:
export DISPLAY=:0
Execute GUI Program. For, example Firefox
$ firefox "www.shellhacks.com"
Use nohup to prevent a process from being stopped after closing SSH session
$ nohup firefox "www.shellhacks.com"
More Examples
Send a pop-up notification (notify-send) that will be shown on the remote computer's screen
$ ssh 192.168.0.100 'DISPLAY=:0 nohup notify-send "Hello" "World"'
Start a music player (rhythmbox) on the remote computer
$ ssh 192.168.0.100 'DISPLAY=:0 nohup rhythmbox ./Smoke-on-the-Water.mp3'
Connect to remote PC and run it's Software GUI at YOUR PC!
Quick Reference - xhost
xhost + hostname: Adds hostname to X server access control list.
xhost - hostname: Removes hostname from X server access control list.
xhost + : Turns off acccess control - (This means that all remote hosts will have access to X server!)
xhost - : Turns access control back on.
Connect to remote PC and run it's Software GUI at YOUR PC!
Quick Reference - xhost
xhost + hostname: Adds hostname to X server access control list.
xhost - hostname: Removes hostname from X server access control list.
xhost + : Turns off acccess control - (This means that all remote hosts will have access to X server!)
xhost - : Turns access control back on.
Disable/Enable Startup Services using Upstart
Locate the Service/Program upstart configuration in: /etc/init/ directory (example SSH Server: /etc/init/ssh.conf)
Type: # echo "manual" >> /etc/init/ssh.conf
Else, you can add an OVERRIDE file, typing the following: # echo "manual" >> /etc/init/ssh.override
Then you can manually control run/stop services using: # initctl [start|stop] service_name
To ENABLE the service again:
Delete "manual" from the end of the /etc/init/ssh.conf file
RENAME or DELETE the /etc/init/ssh.override file
Reset or Remove avast! Authorization Password to Access Settings
Requirements:
Boot to safe mode or other way to access files with the OS offline
In Windows, after bootin to Safe Mode, simultaneously press Win key+R to bring up the Run window,
Type the following and hit enter:
%ProgramData%\Avast Software\Avast
(for Windows XP: %ALLUSERSPROFILE%\application data\AVAST Software\Avast
Delete or move the aswResp.dat file to another location.
To start Task Manager, take any of the following actions:
Press CTRL+ALT+DELETE, and then click Task Manager.
Press CTRL+SHIFT+ESC.
Right-click an empty area of the taskbar, and then click Task Manager.
How to live stream video from webcam on Linux with VLC
First check your video device and make a note about it
ls /dev/video*
Test your video device with VLC
vlc v4l2:///dev/video0
Configure a stream on VLC and take notes of the next values:
MRL
v4l2:///dev/video0
Edit Options
:v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300
Stream Output String
:sout="#transcode{vcodec=DIV,vb=400,scale=Auto,acodec=mp3,ab=64,channels=2,samplerate=22050}:http{mux=asf,dst=:8080/km} :sout-keep"
Concatenate the previous values like this (you may need to add quotation marks like in the example below)
cvlc -d v4l2:///dev/video0 :v4l2-standard= :input-slave=alsa://hw:0,0
:live-caching=300 ':sout="#transcode{vcodec=DIV,vb=400,scale=Auto,acodec=mp3,ab=64,channels=2,samplerate=22050}:http{mux=asf,dst=:8080/km}' :sout-keep"
Note the -d added to the line of code. It makes the process run on the background (as a daemon).
Fix a broken system with chroot and a Live (CD/USB)
Proper way to prepare chroot to recover a broken Linux installation?
Install the libdvdread4 package
sudo apt-get install libdvdread4
Run the install-css.sh script
sudo /usr/share/doc/libdvdread4/install-css.sh
Rebooting may be necessary. After this, VLC will automatically use it.
Published at http://www.arvydas.co.uk/
Author: Arvydas | Date: Aug 7 2012
You can try to mute and unmute with pactl
This requires just a single command line per action:
Mute On:
pactl set-sink-mute 0 1
Mute Off:
pactl set-sink-mute 0 0
No sound after login - Kali 2016.2
Published at https://unix.stackexchange.com/
Author: not2qubit | Date: Jun 2 at 21:47
If you are using Kali under a VM, such as VirtualBox, then don't try to change anything by installing another sound processor! First try to change the VM sound card settings. For example, using a Windows host with Kali guest, latest update. You will find that Intel HD Audio is not supported in Kali (out-of-the-box). So make sure you have the following VM settings:
Host Driver: Windows DirecSound Controller: ICH AC97
If there is still no sound on startup, run the following:
systemctl --user enable pulseaudio && systemctl --user start pulseaudio
Check success with:
systemctl --user status pulseaudio
If still no success, you may need to reboot.
Whatever, you do, don't randomly try to apt-get purge <*pulseaudio> because you may inadvertently remove some Kali features.
OR use the next script to enable audio By nu11secur1ty - http://nu11secur1ty.com/
#!/usr/bin/bash
# By nu11secur1ty - http://nu11secur1ty.com/
#Taken from: https://github.com/nu11secur1ty/pulseaudio
##### Running pulseaudio autostart ~ gui desktop audio
echo -e "\n\e[01;32m[+]\e[00m Preparing pulseaudio"
file=/usr/local/bin/pulseaudio.sh; [ -e $file ] && cp -n $file{,.bkup}
echo -e '#!/bin/bash\ntimeout 10 pulseaudio -D\nsleep 15\nexit 0;'> $file
chmod 0500 $file
mkdir -p /root/.config/autostart/
file=/root/.config/autostart/pulseaudioscript.sh.desktop; [ -e $file ] && cp -n $file{,.bkup}
echo -e '\n[Desktop Entry]\nType=Application\nExec=/usr/local/bin/pulseaudio.sh\nHidden=false\nNoDisplay=false\nX-GNOME-Autostart-enabled=true\nName[en_US]=pulseaudio\nName=pulseaudio\nComment[en_US]=\nComment=' > $file
sleep 5;
echo "After reboot your system everything will be ok with your audio controller. Have fun -;)"
exit 0;
Safe Reboot on Linux (spanish)
( Also you may need to know how to control the use of SysRq keys )
Press the keys Alt + Prnt Scrn (keep them pressed at the same time)
You can try to keep ALT pressed while releasing the Prnt Scrn and pressing the key sequence R S E I U B
or R E I S U B
or R E I S U B
What does the key combination do?
R = Sets Keyboard raw mode (takes away the X server control)
E = Sends TERM signal to all processes (ASK them to end)
I = Sends KILL signal to all processes (FORCES them to end)
S = Synchronize cache data to the disks
U = Remounts file systems read=only
B = Reboots
N = Resets the process priority level (nice) for all realtime and high priority processes
F = oom_kill (to kill a memory=hoggs)
O = Shutsdown
Remember to allow time to complete each command (wait some time between each key press)
NOTE:
This keystroke WILL NOT WORK with a freeze kernel.
The keystrokes sequences depends on the kernel!
Full Access to Windows 10 Disk/Partition by Disable/Enable Hiberboot using REG from CLI
Created by: Shawn Brink
http://www.tenforums.com
Tutorial: http://www.tenforums.com/tutorials/4189-fast-startup-turn-off-windows-10-a.html
You could gain access full access to the content of a Windows HDD from a linux boot disk by first ...
Turning off Fast Startup:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 0 /F
To ENABLE Fast Startup again:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /V HiberbootEnabled /T REG_dWORD /D 1 /F
Bonus
Enable hibernate with:
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power" /V HibernateEnabled /T REG_dWORD /D 1 /F
Disable hibernate with:
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power" /V HibernateEnabled /T REG_dWORD /D 0 /F
Or use the CLI tool:
powercfg -h on
note: Hibernate requires a BIG hiberfil.sys file under root path of system partition!
Disable or Delete the ScreenSaver from CLI
You could completrly remove the screensaver from a linux computer (Ubuntu based) by ...
apt remove -y xscreensaver
The Upstart Event System: What is it and how to use it
PostedAugust 21, 2014
Initialization is a crucial procedure that lies at the heart of any Unix-based operating system to control the operation of every script and service. This is essential in a server environment, where issues can occur at the critical points of startup and shutdown, and where ensuring optimal performance is a priority.
In essence, initialization follows this kind of process:
The server boots The init process runs (usually as PID 1)
A predefined set of startup tasks activate in sequence Initialization is responsible for ensuring the cloud server can boot up and shut down cleanly.
Some distributions with a Unix foundation utilize the standard init process for initialization
In this article, we'll take a look at Upstart – a practical and powerful replacement that can supercharge your server's operations.
Fix a broken system with chroot and a Live (CD/USB)
Proper way to prepare chroot to recover a broken Linux installation?
Install the libdvdread4 package
sudo apt-get install libdvdread4
Run the install-css.sh script
sudo /usr/share/doc/libdvdread4/install-css.sh
Rebooting may be necessary. After this, VLC will automatically use it.
Fix a broken system with chroot and a Live (CD/USB)
Proper way to prepare chroot to recover a broken Linux installation?
Install the libdvdread4 package
sudo apt-get install libdvdread4
Run the install-css.sh script
sudo /usr/share/doc/libdvdread4/install-css.sh
Rebooting may be necessary. After this, VLC will automatically use it.
Proper way to prepare chroot to recover a broken Linux installation?
Install the libdvdread4 package
sudo apt-get install libdvdread4
Run the install-css.sh script
sudo /usr/share/doc/libdvdread4/install-css.sh
Rebooting may be necessary. After this, VLC will automatically use it.
What does %~dp0 mean, and how does it work
Calling for /?
in the command-line gives help about this syntax (which can be used outside FOR, too, this is just the place where help can be found).
In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
environment variable for %I and expands to the
drive letter and path of the first one found.
%~ftzaI - expands %I to a DIR like output line
In the above examples %I and PATH can be replaced by other valid values. The %~ syntax is terminated by a valid FOR variable name. Picking upper case variable names like %I makes it more readable and avoids confusion with the modifiers, which are not case sensitive.
There are different letters you can use like f for "full path name", d for drive letter, p for path, and they can be combined. %~ is the beginning for each of those sequences and a number I denotes it works on the parameter %I (where %0 is the complete name of the batch file, just like you assumed).
AdNauseam: a free browser extension designed to obfuscate browsing and protect from tracking
As online advertising becomes ever more ubiquitous and unsanctioned, AdNauseam works to complete the cycle by automating Ad clicks universally and blindly on behalf of its users. Built atop uBlock Origin, AdNauseam quietly clicks on every blocked ad, registering a visit on ad networks' databases. As the collected data gathered shows an omnivorous click-stream, user tracking, targeting and surveillance become futile.
he software follows an approach similar to that of TrackMeNot, employing obfuscation as a strategy to shift the balance of power between the trackers and the tracked. For further information on this approach, please see this paper.
To configure monitors when using a desktop with a Graphical User Interface on Linux a tool like aranrd.
To configure monitors from command line on linux,first, invoque xranrd:
my@machine:~$ xrandr
Screen 0: minimum 8 x 8, current 2304 x 720, maximum 32767 x 32767
LVDS1 connected primary 1024x600+0+0 (normal left inverted right x axis y axis) 220mm x 130mm
1024x600 60.03*+
1024x576 59.90 59.82
960x540 59.63 59.82
800x600 60.32 56.25
864x486 59.92 59.57
640x480 59.94
720x405 59.51 58.99
640x360 59.84 59.32
512x300 60.00
VGA1 connected 1280x720+1024+0 (normal left inverted right x axis y axis) 0mm x 0mm
1280x720 60.00*+
800x600 60.32
640x480 59.94
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Use this information to configure your displays output:
To "mirror" (have the same output at) a laptop display and another monitor/projector:
xrandr --output VIRTUAL1 --off \
--output LVDS1 --primary --mode 800x600 --pos 0x0 --rotate normal --output VGA1 --mode 800x600 --pos 0x0 --rotate normal
To "extend" (have a different but contiguous output at) a laptop display and another monitor/projector:
xrandr --output VIRTUAL1 --off \
--output LVDS1 --primary --mode 1024x600 --pos 0x0 --rotate normal --output VGA1 --mode 1280x720 --pos 1024x0 --rotate normal
Published at https://blog.desdelinux.net/
usemoslinux | 28 de octubre de 2012 | ArchivoUsemosLinux, Recomendados
Para modificar las resoluciones existe el comando “xrandr” (X Resize & Rotate). Con este comando se configura la resolución de pantalla, pero además se pueden añadir nuevas resoluciones siempre que las soporte el monitor.
Comentar que existen varias interfaces gráficas: grandr, arandr.
Para ver las resoluciones detectadas por el sistema basta con llamar a este comando y ver el resultado, en mi caso:
informiguel ~ $ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0
800x600 60.3 56.2
848x480 60.0
640x480 59.9
S-video disconnected (normal left inverted right x axis y axis)
Como se puede ver, para una resolución de 1024×768 sólo ofrece 60.0 Hz.
Bueno, voy a añadir la resolución en la que mejor me encuentro y que ofrece mi monitor: 1024×768 a 85 Hz. Evidentemente cada monitor tiene sus propias características que hay que consultar.
El problema está en que para crear una nueva resolución se necesitan unos datos “muy extraños” como son la frecuencia vertical, horizontal, máxima, mínima, total, … Pero Linux también tiene la solución con el comando “cvt”, una utilidad para calcular los modos VESA necesarios para alcanzar una resolución. Bueno, si yo quiero 1024×768 a 85 hz escribo:
informiguel ~ $ cvt 1024 768 85
# 1024x768 84.89 Hz (CVT 0.79M3) hsync: 68.68 kHz; pclk: 94.50 Mhz
Modeline "1024x768_85.00" 94.50 1024 1096 1200 1376 768 771 775 809 -hsync +vsync
También puedes probar con “gtf” que hace más o menos lo mismo:
informiguel ~ $ gtf 1024 768 85
# 1024x768 @ 85.00 Hz (GTF) hsync: 68.60 kHz; pclk: 94.39 MHz
Modeline "1024x768_85.00" 94.39 1024 1088 1200 1376 768 769 772 807 -HSync +Vsync
Y de esta forma aparece el “Modeline” que tengo que utilizar con “xrandr”. No te asustes si los hz no coinciden del todo (94.50 en lugar de 85).
Paso a añadir esa resolución copiando el “modeline” obtenido: (un detalle, cuando se pone una opción con su nombre largo como “newmode” va precedido de 2 guiones, tal vez no se noten mucho, mientras que otras veces sólo va 1 guíón como en el caso de “hsync”)
informiguel ~ $ xrandr --newmode "1024x768_85.00" 94.50 1024 1096 1200 1376 768 771 775 809 -hsync +vsync
Si comprobamos el resultado:
informiguel ~ $ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0*
800x600 60.3 56.2
848x480 60.0
640x480 59.9
S-video disconnected (normal left inverted right x axis y axis)
1024x768_85.00 (0x137) 94.5Mhz
h: width 1024 start 1096 end 1200 total 1376 skew 0 clock 68.7KHz
v: height 768 start 771 end 775 total 809 clock 84.9Hz
Se ve el nuevo “Modeline” creado. ¡Me gusta como suena “Modeline”! Si un día tengo un gato lo llamaré así.
Bueno, seguimos, ahora tengo que añadir este nuevo modo a la lista de modos disponibles:
informiguel ~ $ xrandr –addmode VGA-0 1024x768_85.00
Lo de “VGA-0”, si te fijas en los resultados de “xrandr”, es como se llama mi tarjeta gráfica. Vemos el resultado, ¡Perfecto!
informiguel ~ $ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right
1024x768 60.0*
800x600 60.3 56.2
848x480 60.0
640x480 59.9
1024x768_85.00 84.9
S-video disconnected (normal left inverted right x axis y axis)
Ahora sólo queda aplicar esa resolución al monitor:
informiguel ~ $ xrandr --output VGA-0 --mode 1024x768_85.00
Un parpadeo y el monitor se pone más guapo que nunca.
¿Y si quiero poner una resolución de 800×600 con un tasa de refresco de 60 hz (veo que hay 2 refrescos disponibles en este modo, 60.3 y 56.2)? Se puede hacer de esta manera:
informiguel ~ $ xrandr -s 800x600 -r 60
Fijarse que en el refresco se uso 60 en lugar de 60.3, ya que este último no lo admitía. Ahora vamos a volver a la resolución guapa:
informiguel ~ $ xrandr -s 1024x768_85.00
Si tomase por defecto el refresco a 60 hz, entonces escrbimos:
informiguel ~ $ xrandr -s 1024x768_85.00 -r 85
¿Y si me equivoco y quiero quitarlo todo? Pues nada, vamos allá. Para borrar esta resolución de la lista de modos disponibles:
informiguel ~ $ xrandr --delmode VGA-0 1024x768_85.00
Si visualizo el resultado:
informiguel ~ $ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0*
800x600 60.3 56.2
848x480 60.0
640x480 59.9
S-video disconnected (normal left inverted right x axis y axis)
1024x768_85.00 (0x136) 94.5Mhz
h: width 1024 start 1096 end 1200 total 1376 skew 0 clock 68.7KHz
v: height 768 start 771 end 775 total 809 clock 84.9Hz
Ya está borrado de la lista, pero ahora aparecen los datos del modo como se había creado (–newmode) anteriormente. Para borrar esto también:
informiguel ~ $ xrandr --rmmode 1024x768_85.00
Vemos el resultado:
informiguel ~ $ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.0*
800x600 60.3 56.2
848x480 60.0
640x480 59.9
S-video disconnected (normal left inverted right x axis y axis)
Todo quedo como al principio del artículo…
Y para finalizar, yo se que eres un bromista, así que prueba esto:
En primer lugar escribe esto, que no hace cambios en este momento:
informiguel ~ $ xrandr --output VGA-0 --rotate normal
Y ahora prueba lo siguiente teniendo en cuenta que para quitar la broma tienes que repetir la instrucción anterior (basta con seleccionarla usando las teclas de cursor):
informiguel ~ $ xrandr --output VGA-0 --rotate left
Hasta aquí todo muy bonito pero hay un problema, al reiniciar el equipo las configuraciones se pierden. No me parece buena idea ajustar el refresco de pantalla cada vez que entramos en el equipo, tiene que haber una forma de dejarlo fijo. Vamos a ello.
En Linux hay un fichero de configuración que poco a poco y a medida que el hardware fue mejor reconocido por las distribuciones, fue quedando en el olvido. Su nombre con ruta completa es «/etc/X11/xorg.conf». El fichero de configuración de todos los parámetros que hacen que el entorno gráfico funcione.
En LXDE (entorno de escritorio X11 ligero) el fichero no existe, con lo cual hay que crearlo, cosa que no es fácil. Una posible solución es hacer lo siguiente:
Nos salimos del entorno gráfico, vamos a una terminal pulsando CTRL + ALT + F1, recordar que el entorno gráfico es CTRL + ALT + F7). Nos validamos y “apagamos” el entorno gráfico:
informiguel ~ $ sudo /etc/init.d/lxdm stop
A continuación ejecutamos la configuración de X:
informiguel ~ $ sudo X -configure
Se crea un fichero de nombre “xorg.conf.new” el cual es el que debemos mover a su sitio y modificar:
informiguel ~ $ mv xorg.conf.new /etc/X11/xorg.conf
Si todo está correcto y queremos volver a arrancar el entorno gráfico:
informiguel ~ $ sudo /etc/init.d/lxdm start
Existe otra solución que puede ser mejor, arrancas con una ditribución de Linux en “CD Live” y copias el fichero cuya ruta completa es “/etc/X11/xorg.conf” y lo pegas tu distribución. Si esa distribución detectó bien el monitor se acabaron los problemas, en caso contrario hay que retocar el fichero con los datos del refresco de pantalla y resolución que quieras. Como ejemplo, yo tuve que añadir lo siguiente para que el refresco fuese el adecuado:
Section "Monitor"
Identifier "Monitor genérico"
Option "DPMS"
HorizSync 30-70
VertRefresh 50-120
Modeline "1024x768_85.00" 94.39 1024 1088 1200 1376 768 769 772 807 -HSync +Vsync
Option "PreferredMode" "1024x768_85.00"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "ATI Technologies, Inc. Radeon RV250 If [Radeon 9000 Pro]"
Monitor "Monitor genérico"
DefaultDepth 24
Option "AddARGBGLXVisuals" "True"
Option "Metamode" "1024x768_85.00 +0+0"
Option "UseEdid" "False"
SubSection "Display"
Depth 1
Modes "1024x768" "800x600" "640x480"
EndSubSec...................etc
Muy importante, buscar las características técnicas del monitor para conocer la sincronización vertical y horizontal.
Como se ve en la imagen el “Modeline” es el que se calculó con el comando “cvt”.
Una vez realizados los cambios necesarios ya queda todo listo para ejecutarse automáticamente la próxima vez que arranques el equipo. Problema resuelto.
Play VLC on Linux from CLI on Projector/Second Monitor:
You can play a video on a second monitor with this command:
vlc -f --qt-fullscreen-screennumber=1 myvideo.mp4 &
Or play a video on a second monitor with this command:
vlc -f --qt-fullscreen-screennumber=1 --open https://youtu.be/rW2OBIZoTOQ &
Linux Commands Cheat Sheet - from linuxtrainingacademy.com
https://randomnerdtutorials.com/arduino-mini-course-access/
https://randomnerdtutorials.com/home-automation-using-esp8266/
https://randomnerdtutorials.com/learn-esp32-with-arduino-ide/
https://s3.amazonaws.com/rnt-user-unique-download-key/JSADFhewfJDSfahdfuwe/Ultimate_Guide_Arduino_Sensors_Modules.zip
https://randomnerdtutorials.com/build-a-home-automation-system-for-100/
https://s3.amazonaws.com/rnt-user-unique-download-key/JSADFhewfJDSfahdfuwe/Ultimate_Guide_Arduino_Sensors_Modules.zip
https://s3.amazonaws.com/rnt-user-unique-download-key/JSADFhewfJDSfahdfuwe/ESP8266_Web_Server_with_Arduino_IDE.zip
https://s3.amazonaws.com/rnt-user-unique-download-key/JSADFhewfJDSfahdfuwe/ESP32_Web_Server_with_Arduino_IDE.zip
Use this registry tweak to restore “Users must enter a user name and password to use this computer” checkbox:
1. Press WIN+R keys together to launch RUN dialog box. Now type regedit and press Enter. It’ll open Registry Editor.
2. Now go to following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device
3. In right-side pane, look for DevicePasswordLessBuildVersion DWORD.
The value of this DWORD would be set to 2 in your device.
Double-click on DevicePasswordLessBuildVersion and change its value to 0
That’s it. Now open “control userpasswords2” or “netplwiz” programs and you’ll get “Users must enter a user name and password to use this computer” checkbox back.
NOTE: If the checkbox doesn’t appear after editing Registry, restart your computer and it’ll appear now.
PS: If you don’t want to modify Registry Editor manually or if you can’t see above mentioned key in Registry, you can run following command in Command Prompt directly:
reg ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v DevicePasswordLessBuildVersion /t REG_DWORD /d 0 /f
It’ll do the same job and bring back missing checkbox in Windows 10.