Tuesday, July 31, 2018

Ubuntu torrent client - Transmission-cli

If you need a torrent client on Ubuntu server you can use transmission package. This tutorial explains only command line interface.

sudo apt-get install transmission-cli
Cli package has no setting file! You have to give settings with parameters.

Get help
$ transmission-cli --help
transmission-cli 2.92 (14714)
A fast and easy BitTorrent client

Usage: transmission-cli [options] <file|url|magnet>

 -h  --help                          Display this help page and exit
 -b  --blocklist                     Enable peer blocklists
 -B  --no-blocklist                  Disable peer blocklists
 -d  --downlimit            <speed>  Set max download speed in kB/s
 -D  --no-downlimit                  Don't limit the download speed
 -er --encryption-required           Encrypt all peer connections
 -ep --encryption-preferred          Prefer encrypted peer connections
 -et --encryption-tolerated          Prefer unencrypted peer connections
 -f  --finish               <script> Run a script when the torrent finishes
 -g  --config-dir           <path>   Where to find configuration files
 -m  --portmap                       Enable portmapping via NAT-PMP or UPnP
 -M  --no-portmap                    Disable portmapping
 -p  --port                 <port>   Port for incoming peers (Default: 51413)
 -t  --tos                  <tos>    Peer socket TOS (0 to 255,
 -u  --uplimit              <speed>  Set max upload speed in kB/s
 -U  --no-uplimit                    Don't limit the upload speed
 -v  --verify                        Verify the specified torrent
 -V  --version                       Show version number and exit
 -w  --download-dir         <path>   Where to save downloaded data
Usage: transmission-cli [options]
Download a torrent with download directory parameter.
sudo transmission-cli  http://torrent.ubuntu.com:6969/file?info_hash=D%C0%809M3%5B%03%0B%13%FA%F1%3F%A8%84%CD%22%15%028 --download-dir "/home/ubuntu/Downloads"
You can use magnet link instead of torrent file url.
If you are using AWS or any firewall, don't forget to give permission for "Port for incoming peers (Default: 51413)"
After download finishes you will see transmission will continue to run for seeding. It may be annoying if you are working on terminal because it interrupts terminal window (even you press to Ctrl-C to quit).
To kill the process type ps to see process id.
  PID TTY          TIME CMD
11659 pts/0    00:00:00 sudo
11668 pts/0    00:00:00 transmission-cl
Then kill process.
$ kill 11668

Sunday, July 29, 2018

Linux commands - Process

List running processes
$ ps -A
  PID TTY          TIME CMD
    1 ?        00:00:03 systemd
    2 ?        00:00:00 kthreadd
    4 ?        00:00:00 kworker/0:0H
    6 ?        00:00:00 mm_percpu_wq
    7 ?        00:00:00 ksoftirqd/0
    8 ?        00:00:00 rcu_sched
    9 ?        00:00:00 rcu_bh
   10 ?        00:00:00 migration/0
   11 ?        00:00:00 watchdog/0
   12 ?        00:00:00 cpuhp/0
 4712 ?        00:00:00 nginx
Kill a process
$ kill [signal] PID(s)

$ kill -9 3139

Signal Name  Signal Value  Behaviour
SIGHUP   1   Hangup
SIGKILL   9   Kill Signal
SIGTERM   15   Terminate
Filter process by name
$ ps aux | grep nginx

root      4712  0.0  0.1 140644  1452 ?        Ss   Jul27   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data  4714  0.0  0.4 143260  4212 ?        S    Jul27   0:00 nginx: worker process
ubuntu   11494  0.0  0.1  14856  1056 pts/0    S+   10:50   0:00 grep --color=auto nginx

$ pgrep nginx

Kill process by name
$ pkill nginx

$ killall nginx

Friday, July 6, 2018

Anonymous level security token - Windows Server

During a software installation if setup fails and shows similar logs like below then it is related with Windows Component system.

MSI (c) (48:B0) SOFTWARE RESTRICTION POLICY: Verifying package --> '...\NC.x64.msi' against software restriction policy 
MSI (c) (48:B0)  Note: 1: 2262 2: DigitalSignature 3: -2147287038  
MSI (c) (48:B0)  SOFTWARE RESTRICTION POLICY: ...\NC.x64.msi is not digitally signed 
MSI (c) (48:B0) SOFTWARE RESTRICTION POLICY: ...\NC.x64.msi is permitted to run at the 'unrestricted' authorization level.
The software which I tried to install had prerequisites (Dotnet Framework 3.5 etc).
After error, I tried to install Dotnet 3.5 manually from "Server Manager" by clicking "Add roles and features" link. But it failed and showed error below:

Anonymous level security token
To solve I followed these steps:

  1. Click Start > Run, type dcomcnfg.exe
  2. Click OK if you see the UAC warning
  3. Go to Component Services> Computers in the tree
  4. Right click My Computer > select Properties.
  5. Click Default Properties tab
  6. Select Connect in the Default Authentication Level list 
  7. Select Identify in the Default Impersonation Level list
  8. Click OK, and confirm the selection
  9. Close Component Services console