Pages

Sunday, June 14, 2020

Public Samba Share Ubuntu

 From:https://websiteforstudents.com/create-public-samba-share-ubuntu-17-04-17-10/

 

Step 1: Install Samba

The first thing you’ll need to do is install Samba. To install it run the commands below.
sudo apt-get update
sudo apt-get install samba
The commands above install Samba and all other dependencies.

Step 2: Create the Share

First, create the folder you  want to share with the public. The folder can be anywhere but set its permission so that everyone can access it. For this this tutorial, our share will be /home/Public
Run the commands below to create the folder you wish to share.
sudo mkdir /home/Public
Then set the share permission so everyone has full access to it.
sudo chmod 0777 /home/Public
sudo chown -R nobody:nogroup /home/Public

Step 3: Configure Samba

Now that Samba is installed, you must now configure it to provide file and print services to clients. This can be done by editing its default configurations file. First create a backup of the configuration file by running the commands below.
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
Next, run the commands below to open/create a new configuration file.
sudo nano /etc/samba/smb.conf
Then add the content below into the file and save. Our share will be called Public as defined in the setting below  [Public]
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
name resolve order = bcast host
dns proxy = no
bind interfaces only = yes

# add to the end
[Public]
   path = /home/Public
   writable = yes
   guest ok = yes
   guest only = yes
   read only = no
   create mode = 0777
   directory mode = 0777
   force user = nobody
Save the file and exit

Step 4: Restart Samba

After configuring the setting above, restart Samba by running the commands below.
sudo systemctl restart smbd

Wednesday, February 19, 2020

Activate SWAP on Asus RT-AC68U router

From: https://mydevtutorials.wordpress.com/2014/01/10/how-to-activate-swap-on-asus-rt-ac68u-router/

To enable linux SWAP on your Asus RT-AC68U router you need the following:
  • Custom firmware with jffs partition enabled (I recommend Asuswrt-Merlin build);
  • an USB HDD or USB flash drive to mount on one of your router’s USB ports.

Using a swap file

To enable swapping using a swap file you need to first create the file, prepare it for swapping and then enable the swapping on it. First of, make sure the file system the disk you wish to swap on is properly mounted. If you chose labels for the partitions, use them instead of sda1, sda2, sdb1, etc.
1
2
#check how the disk was mounted
ls -l /tmp/mnt
For the purposes of this tutorial we will assume the disk is mounted as /tmp/mnt/sda1/ and we want to use the file /tmp/mnt/sda1/myswap.swp for swapping.
1
2
3
4
5
6
7
8
9
10
11
#create a 256MB swap file ("count" is in Kilobytes)
dd if=/dev/zero of=/tmp/mnt/sda1/myswap.swp bs=1k count=262144
 
#set up the swap file
mkswap /tmp/mnt/sda1/myswap.swp
 
#enable swap
swapon /tmp/mnt/sda1/myswap.swp
 
#check if swap is on
free
If you reboot your router, the swap will be inactive until you swapon again. To do this automatically you have to create the file /jffs/scripts/post-mount, or edit it if exists and add the line (nano works):
1
2
#!/bin/sh
swapon /tmp/mnt/sda1/myswap.swp
Now every time the router reboots, it will turn on swap.

Using a swap partition

This method is not recommended if using USB storage with multiple partitions.
  1. Using your computer, create a linux-swap partition on your disk that will be mounted on the router. You can use GParted for linux, MiniTool Partition Wizard Home Edition for Windows or Disk Utility for MacOS;
  2. Connect the formatted drive to router and in PuTTY terminal use command fdisk -l to see how it was mounted. Let’s asume it is mounted as sda1;
  3. Again in PuTTY terminal use command swapon /dev/sda1 and then free to see if swap is correctly activated;
  4. If swap is correctly activated, use the script /jffs/scripts/post-mount with the command swapon /dev/sda1 as mentioned above.
1
2
#!/bin/sh
swapon /dev/sda1

Warning!

Do not use SWAP (partition or file) on a device which goes to hibernation or does spin-down. You might make the router more unstable than without using SWAP.
Be sure you deactivate spin-down on the device which you want to use for SWAP.
Spin-down settings on ASUS router powered by Asuswrt-Merlin
Spin-down settings on ASUS router powered by Asuswrt-Merlin
There are some devices, like the Western Digital USB HDDs WD Elements, My Book or My Passport which have their own power management and will not be affected by the settings on the router and they will spin-down if data is not read or written for some time. I recommend to avoid this kind of devices for SWAP.
Info source:
http://www.dd-wrt.com/wiki/index.php/Linux_SWAP