- sudo user to admin
- Open the /etc/apache2/apache2.conf file.
$ sudo nano /etc/apache2/apache2.conf
Find the content below.
... <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> ...
Change the line:
Options Indexes FollowSymLinks
to:
Options -Indexes +FollowSymLinks
When finished, it should look like this.
... <Directory /var/www/> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory>
Author Archives: administrator
ZOHD Test flight wing
ZOHD Kopilot Lite test
copy the contents of a folder to another folder ubuntu
Check this http://www.cyberciti.biz/faq/copy-folder-linux-command-line/ for more information on copying folder. Hope this helps.
cp Command
cp
is a Linux command for copying files and directories. The syntax is as follows:
cp source destination
cp dir1 dir2
cp -option source destination
cp -option1 -option2 source destination
In this example copy /home/vivek/letters
folder and all its files to /usb/backup
directory:
cp -avr /home/vivek/letters /usb/backup
Where,
-a
: Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.
-v
: Explain what is being done.
-r
: Copy directories recursively. Example
Copy a folder called /tmp/conf to /tmp/backup:
$ cp -avr /tmp/conf/ /tmp/backup
How to Create a New User mysql
- mysql >CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;
- mysql> GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@’localhost’;
- mysql> FLUSH PRIVILEGES;
How To Grant Different User Permissions
Here is a short list of other common possible permissions that users can enjoy.
- ALL PRIVILEGES- as we saw previously, this would allow a MySQL user full access to a designated database (or if no database is selected, global access across the system)
- CREATE- allows them to create new tables or databases
- DROP- allows them to them to delete tables or databases
- DELETE- allows them to delete rows from tables
- INSERT- allows them to insert rows into tables
- SELECT- allows them to use the
SELECT
command to read through databases - UPDATE- allow them to update table rows
- GRANT OPTION- allows them to grant or remove other users’ privileges
To provide a specific user with a permission, you can use this framework:
mysql> GRANT type_of_permission ON database_name.table_name TO ‘username’@’localhost’;
If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.
Each time you update or change a permission be sure to use the Flush Privileges command.
If you need to revoke a permission, the structure is almost identical to granting it:
mysql> REVOKE type_of_permission ON database_name.table_name FROM ‘username’@’localhost’;
Note that when revoking permissions, the syntax requires that you use FROM
, instead of TO
as we used when granting permissions.
You can review a user’s current permissions by running the following:
mysql> SHOW GRANTS FOR ‘username’@’localhost’;
Just as you can delete databases with DROP, you can use DROP to delete a user altogether:
mysql> DROP USER ‘username’@’localhost’;
To test out your new user, log out by typing:
mysql> quit
Create a New User and Grant Permissions in MySQL
In Part 1 of the MySQL Tutorial, we did all of the editing in MySQL as the root user, with full access to all of the databases. However, in cases where more restrictions may be required, there are ways to create users with custom permissions.
Let’s start by making a new user within the MySQL shell:
mysql> CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;
mysql>RANT ALL PRIVILEGES ON * . * TO ‘newuser‘@‘localhost’;
mysql>FLUSH PRIVILEGES;
Ubuntu Uninstall bind9
Uninstall bind9
To remove just bind9 package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal:
sudo apt-get remove bind9
Uninstall bind9 and it’s dependent packages
To remove the bind9 package and any other dependant package which are no longer needed from Ubuntu Xenial.
sudo apt-get autoremove bind9
Purging bind9
If you also want to delete configuration and/or data files of bind9 from Ubuntu Xenial then this will work:
sudo apt-get purge bind9
To delete configuration and/or data files of bind9 and it’s dependencies from Ubuntu Xenial then execute:
sudo apt-get autoremove --purge bind9
More information about apt-get remove
Firewall UFW on Ubuntu 20.04
UFW is installed by default on Ubuntu. If it has been uninstalled for some reason, you can install it with sudo apt install ufw
.
Step 1 — Using IPv6 with UFW (Optional)
This tutorial is written with IPv4 in mind, but will work for IPv6 as well as long as you enable it. If your Ubuntu server has IPv6 enabled, ensure that UFW is configured to support IPv6 so that it will manage firewall rules for IPv6 in addition to IPv4. To do this, open the UFW configuration with nano
or your favorite editor.
Then make sure the value of IPV6
is yes
. It should look like this:
Save and close the file. Now, when UFW is enabled, it will be configured to write both IPv4 and IPv6 firewall rules. However, before enabling UFW, we will want to ensure that your firewall is configured to allow you to connect via SSH. Let’s start with setting the default policies.
Step 2 — Setting Up Default Policies
If you’re just getting started with your firewall, the first rules to define are your default policies. These rules control how to handle traffic that does not explicitly match any other rules. By default, UFW is set to deny all incoming connections and allow all outgoing connections. This means anyone trying to reach your server would not be able to connect, while any application within the server would be able to reach the outside world.
Let’s set your UFW rules back to the defaults so we can be sure that you’ll be able to follow along with this tutorial. To set the defaults used by UFW, use these commands:
These commands set the defaults to deny incoming and allow outgoing connections. These firewall defaults alone might suffice for a personal computer, but servers typically need to respond to incoming requests from outside users. We’ll look into that next.
Step 3 — Allowing SSH Connections
If we enabled our UFW firewall now, it would deny all incoming connections. This means that we will need to create rules that explicitly allow legitimate incoming connections — SSH or HTTP connections, for example — if we want our server to respond to those types of requests. If you’re using a cloud server, you will probably want to allow incoming SSH connections so you can connect to and manage your server.
To configure your server to allow incoming SSH connections, you can use this command:
This will create firewall rules that will allow all connections on port 22
, which is the port that the SSH daemon listens on by default. UFW knows what port allow ssh
means because it’s listed as a service in the /etc/services
file.
However, we can actually write the equivalent rule by specifying the port instead of the service name. For example, this command works the same as the one above:
If you configured your SSH daemon to use a different port, you will have to specify the appropriate port. For example, if your SSH server is listening on port 2222
, you can use this command to allow connections on that port:
Now that your firewall is configured to allow incoming SSH connections, we can enable it.
Step 4 — Enabling UFW
To enable UFW, use this command:
You will receive a warning that says the command may disrupt existing SSH connections. We already set up a firewall rule that allows SSH connections, so it should be fine to continue. Respond to the prompt with y
and hit ENTER
.
The firewall is now active. Run the sudo ufw status verbose
command to see the rules that are set. The rest of this tutorial covers how to use UFW in more detail, like allowing or denying different kinds of connections.
Step 5 — Allowing Other Connections
At this point, you should allow all of the other connections that your server needs to respond to. The connections that you should allow depends on your specific needs. Luckily, you already know how to write rules that allow connections based on a service name or port; we already did this for SSH on port 22
. You can also do this for:
- HTTP on port 80, which is what unencrypted web servers use, using
sudo ufw allow http
orsudo ufw allow 80
- HTTPS on port 443, which is what encrypted web servers use, using
sudo ufw allow https
orsudo ufw allow 443
There are several others ways to allow other connections, aside from specifying a port or known service.
Specific Port Ranges
You can specify port ranges with UFW. Some applications use multiple ports, instead of a single port.
For example, to allow X11 connections, which use ports 6000
–6007
, use these commands:
When specifying port ranges with UFW, you must specify the protocol (tcp
or udp
) that the rules should apply to. We haven’t mentioned this before because not specifying the protocol automatically allows both protocols, which is OK in most cases.
Specific IP Addresses
When working with UFW, you can also specify IP addresses. For example, if you want to allow connections from a specific IP address, such as a work or home IP address of 203.0.113.4
, you need to specify from
, then the IP address:
You can also specify a specific port that the IP address is allowed to connect to by adding to any port
followed by the port number. For example, If you want to allow 203.0.113.4
to connect to port 22
(SSH), use this command:
Subnets
If you want to allow a subnet of IP addresses, you can do so using CIDR notation to specify a netmask. For example, if you want to allow all of the IP addresses ranging from 203.0.113.1
to 203.0.113.254
you could use this command:
Likewise, you may also specify the destination port that the subnet 203.0.113.0/24
is allowed to connect to. Again, we’ll use port 22
(SSH) as an example:
Connections to a Specific Network Interface
If you want to create a firewall rule that only applies to a specific network interface, you can do so by specifying “allow in on” followed by the name of the network interface.
You may want to look up your network interfaces before continuing. To do so, use this command:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
. . .
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
. . .
The highlighted output indicates the network interface names. They are typically named something like eth0
or enp3s2
.
So, if your server has a public network interface called eth0
, you could allow HTTP traffic (port 80
) to it with this command:
Doing so would allow your server to receive HTTP requests from the public internet.
Or, if you want your MySQL database server (port 3306
) to listen for connections on the private network interface eth1
, for example, you could use this command:
This would allow other servers on your private network to connect to your MySQL database.
Step 6 — Denying Connections
If you haven’t changed the default policy for incoming connections, UFW is configured to deny all incoming connections. Generally, this simplifies the process of creating a secure firewall policy by requiring you to create rules that explicitly allow specific ports and IP addresses through.
However, sometimes you will want to deny specific connections based on the source IP address or subnet, perhaps because you know that your server is being attacked from there. Also, if you want to change your default incoming policy to allow (which is not recommended), you would need to create deny rules for any services or IP addresses that you don’t want to allow connections for.
To write deny rules, you can use the commands described above, replacing allow with deny.
For example, to deny HTTP connections, you could use this command:
Or if you want to deny all connections from 203.0.113.4
you could use this command:
Now let’s take a look at how to delete rules.
Step 7 — Deleting Rules
Knowing how to delete firewall rules is just as important as knowing how to create them. There are two different ways to specify which rules to delete: by rule number or by the actual rule (similar to how the rules were specified when they were created). We’ll start with the delete by rule number method because it is easier.
By Rule Number
If you’re using the rule number to delete firewall rules, the first thing you’ll want to do is get a list of your firewall rules. The UFW status command has an option to display numbers next to each rule, as demonstrated here:
Status: active
To Action From
-- ------ ----
[ 1] 22 ALLOW IN 15.15.15.0/24
[ 2] 80 ALLOW IN Anywhere
If we decide that we want to delete rule 2, the one that allows port 80 (HTTP) connections, we can specify it in a UFW delete command like this:
This would show a confirmation prompt then delete rule 2, which allows HTTP connections. Note that if you have IPv6 enabled, you would want to delete the corresponding IPv6 rule as well.
By Actual Rule
The alternative to rule numbers is to specify the actual rule to delete. For example, if you want to remove the allow http
rule, you could write it like this:
You could also specify the rule by allow 80
, instead of by service name:
This method will delete both IPv4 and IPv6 rules, if they exist.
Step 8 — Checking UFW Status and Rules
At any time, you can check the status of UFW with this command:
If UFW is disabled, which it is by default, you’ll see something like this:
Status: inactive
If UFW is active, which it should be if you followed Step 3, the output will say that it’s active and it will list any rules that are set. For example, if the firewall is set to allow SSH (port 22
) connections from anywhere, the output might look something like this:
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
Use the status
command if you want to check how UFW has configured the firewall.
Step 9 — Disabling or Resetting UFW (optional)
If you decide you don’t want to use UFW, you can disable it with this command:
Any rules that you created with UFW will no longer be active. You can always run sudo ufw enable
if you need to activate it later.
If you already have UFW rules configured but you decide that you want to start over, you can use the reset command:
This will disable UFW and delete any rules that were previously defined. Keep in mind that the default policies won’t change to their original settings, if you modified them at any point. This should give you a fresh start with UFW.
Install Webmin on Ubuntu 20.04
Step 1 — Installing Webmin
First, update your server’s package index if you’ve not done so recently:
Then we need to add the Webmin repository so that we can install and update Webmin using our package manager. We do this by adding the repository to the /etc/apt/sources.list
file.
Open the file in your preferred editor. Here, we’ll use nano
:
Then add this line to the bottom of the file to add the new repository:
Save the file and exit the editor. If you used nano
, do so by pressing CTRL+X
, Y
, then ENTER
.
Next, you’ll add the Webmin PGP key so that your system will trust the new repository. In order to do that, though, you must install the gnupg1
package, which is GNU’s tool for secure communication and data storage.
Following that, download the Webmin PGP key with wget
and add it to your system’s list of keys:
Next, update the list of packages again in order to include the now-trusted Webmin repository:
Then install Webmin:
Once the installation finishes, you’ll be presented with the following output:
. . .
Webmin install complete. You can now login to
https://your_server:10000 as root with your
root password, or as any user who can use sudo.
Note: If you installed and enabled ufw
during the prerequisite step, you will need to run the following command in order to allow Webmin through the firewall:
For extra security, you may want to configure your firewall to only allow access to this port from certain IP ranges.
Let’s secure access to Webmin by adding a valid certificate.
Step 2 — Adding a Valid Certificate with Let’s Encrypt
Webmin is already configured to use HTTPS, but it uses a self-signed, untrusted certificate. Let’s replace it with a valid certificate from Let’s Encrypt.
Navigate to https://your_domain:10000
in your web browser, replacing your_domain
with the domain name pointing to your server’s IP address.
Note: When logging in for the first time, you will see an “Invalid SSL” warning. This warning may say something different depending on your browser, but the reason for it is that the server has generated a self-signed certificate. Allow the exception and proceed to your domain so you can replace the self-signed certificate with one from Let’s Encrypt.
You’ll be presented with a login screen. Sign in with the non-root user you created while fulfilling the prerequisites for this tutorial.
Once you log in, the first screen you will see is the Webmin dashboard. Before you can apply a valid certificate, you have to set the server’s hostname. Look for the System hostname field and click on the link to the right, as shown in the following figure:
This will take you to the Hostname and DNS Client page. Locate the Hostname field, and enter your Fully-Qualified Domain Name into the field. Then click the Save button at the bottom of the page to apply the setting.
After you’ve set your hostname, click on the Webmin dropdown menu in the left-hand navigation bar, and then click on Webmin Configuration.
From the Webmin Configuration page, select SSL Encryption from the list of icons, and then click on the Let’s Encrypt tab. You’ll see a screen like the following figure:
On this page, you’ll tell Webmin how to obtain and renew your certificate. Let’s Encrypt certificates expire after 3 months, but you can instruct Webmin to automatically attempt to renew the Let’s Encrypt certificate every month. Let’s Encrypt looks for a verification file on the server, so we’ll configure Webmin to place the verification file inside the folder /var/www/your_domain
, which is the folder that the Apache web server you configured in the prerequisites uses. Follow these steps to set up your certificate:
- Fill in Hostnames for certificate with your FQDN.
- For Website root directory for validation file, select the Other Directory button and enter your website’s document root. Assuming you followed the prerequisite Apache tutorial this will be
/var/www/your_domain
. - For Months between automatic renewal section, deselect the Only renew manually option by typing
1
into the input box, and select the radio button to the left of the input box.
Click the Request Certificate button. After a few seconds, you will see a confirmation screen.
To use the new certificate, click the Return to Webmin configuration button on the confirmation screen. From that page, scroll down and click the Restart Webmin button. Wait around 30 seconds, and then reload the page and log in again. Your browser should now indicate that the certificate is valid.
Step 3 – Using Webmin
You’ve now set up a secured working instance of Webmin. Let’s look at how to use it.
Webmin has many different modules that can control everything from the BIND DNS Server to adding users to the system. Let’s look at how to create a new user, and then explore how to update your system’s packages using Webmin.
Managing Users and Groups
Let’s explore how to manage the users and groups on your server.
First, click the System dropdown menu in the left-hand sidebar, and then click the link for Users and Groups. From here, you can add and manage users and groups.
Let’s create a new user called deploy which you can use to host web applications. When creating a user, you can set options for password expiry, the user’s shell, and whether or not they are allowed a home directory.
To add a user, click Create a new user, which is located at the top of the users table. This displays the Create User screen, where you can supply the username, password, groups and other options. Follow these instructions to create the user:
- Fill in Username with
deploy
. - Select Automatic for User ID.
- Fill in Real Name with a descriptive name like
Deployment user
. - For Home Directory, select Automatic.
- For Shell, select /bin/bash from the dropdown list.
- For Password, select Normal Password and type in a password of your choice.
- Jump down to Primary Group and select New group with same name as user.
- For Secondary Group, select sudo from the All groups list. This should automatically be added to the In groups list, but if it isn’t press the -> button to add it.
After making those selections, press Create. This will create the deploy user in short order.
Next, let’s look at how to install updates to our system.
Updating Packages
Webmin lets you update all of your packages through its user interface. To update all of your packages, first, click the Dashboard button above the left-hand sidebar, and then locate the Package updates field. If there are updates available, you’ll see a link that states the number of available updates.
Click this link, and then press Update selected packages to start the update. You may be asked to reboot the server, which you can also do through the Webmin interface.
Ubuntu 20.04 Install FreeRADIUS
Prerequisites
Update and upgrade your system packages;
apt update apt upgrade
Install LAMP Stack on Ubuntu 20.04 by following the link below;
Install other required PHP Modules;
apt install php-gd php-mail php-mail-mime php-mysql php-pear php-db php-mbstring php-x
Install and Configure FreeRADIUS on Ubuntu 20.04
Installing FreeRADIUS
Once all the prerequisites above are met, proceed to install FreeRADIUS on Ubuntu 20.04. FreeRADIUS 3.0.x is the latest stable release versions as of this writing and are available on the default Ubuntu 20.04 repos.
To install FreeRADIUS and other FreeRADIUS utilities including MySQL database backend utilities on Ubuntu 20.04, execute the command below; Continue reading
FlySky-i6 Update Firmwares 6ch to 10ch
FlySky-i6-Mod-10ch
Description:
A collection of software modifications for the FlySky i6, some useful, some experiment. All use of this repository is experimental and you use at your own risk. But, progress is being made. Please also note that this project is now contributed by many developers/engineers who deserve lots of recognition for their (free) time, knowledge & effort, so please say thanks to all contributors and not me as a single entity. Open/Free Devs need hugs too. Thanks 🙂
Project goals: Continue reading