Архив рубрики: Linux

Log all input and output in a terminal session

When you are ready to start recording a log file, type:

Now, until you stop the script, all input and output in the Terminal will be stored in screen.log. When you are done, just type:

Your screen.log file will be in your Home folder (/home/user). This will do exactly what you are looking for.

ShrewSoft VPN as an alternative to CiscoVPN

Assume you have been given connection information for a Cisco VPN server:

Host: 64.34.199.12

Group ID: SUPERVENDOR
Password: *318#($@

User ID: ian@superuser.com
Password: ianvendor1234

These are the steps to use ShrewSoft VPN to connect to the Cisco VPN server, rather than the Cisco client:

  1. Create a new connection, and under Host name or IP Address enter the Host address (64.34.199.12):
    4LP1F
  2. On the Authentication tab, select Authentication Method of Mutual PSK + XAuth:
    00pq9
  3. On the Client set  force-rfc in NAT traversal
  4. On the Authentication -> Local Authentication tab select Identification Type of Key Identifier:
    MVGjH
  5. Still on the Authentication -> Local Authentication tab, enter Key ID String of SUPERVENDOR:
    nX0VW
  6. On the Authentication -> Credentials tab, enter your Pre Shared Key of *318#($@:
    8CYf9
  7. Save the newly created connection, and click Connect
  8. When prompted for a username and password, enter your supplied User ID and Password, and click Connect:
    675i4
  9. Run Shrew on LINUX:
    1. Start daemon sudo iked
    2. Run GUI qikea

Dictionary for Mozilla Firefox (Linux) ru_en

Installation instructions
1. Download Russian dict from ru_RU.
2. Find folder with hunspell dictionaries. It is probably

3. Merge Russian and English dict with hunspell-merge.
4. Go to the folder where you have saved the downloaded files and copy them to hunspell folder using command:

5. Find folder with myspell dictionaries. It is probably

6. Make in this folder symbolic links to files prg.dic, prg.aff with the same names using commands:

7. Start Firefox. In a field where it is possible to write press the right mouse key and select check spelling. Next again press the right mouse key. Now there should be visible Languages in the menu. Go there to the list of languages and select prg. From now the automatic spell-checking is activated.

How to copy files from a damaged hard disk with Linux

I just got a hard disk which had bad blocks to try to rescue files, but which was too big to use dd_rescue to copy the whole partition on any other hard disk I had, before extracting the files. But in this case the file system directory structure was still readable, so I was able to use following method, which maybe helps someone else.

1. Install dd_rescue:

2. Mount the file system read only with following

3. Create 2 shell scripts.

First File:

Second File:

I use 2 scripts as sometimes the hard disk runs into a problem and than stops working until it is powered down and up again. In this case I use CRTL-C to break the loop followed by commenting the first 3 commands in the first file out, and than start it again after the harddisk is mounted again. The “if”-query in the second file makes sure we won’t try files which we already have or the one which lead to the error in the first place.

Remove password prompt in virt-manager

Solution 1

When you start virt-manager as a regular user, you may still be asked for the root password, even when you have setup the correct unix socket permissions (notification: “system policy prevents management of local virtualized systems”). This is because older versions of libvirt were using PolicyKit by default. Disable the use of PolicyKit by editing /etc/libvirt/libvirtd.conf. Uncomment the following options and change them to none :

 

Solution 2

Добавить пользователя в группу libvirt, чтобы не требовались root-права при запуске.

Linux badblock

Грузимся с LiveCD диска с ОС Linux.
Входим терминал и выполняем операции:

Для начала смотрим полный список накопителей с томами:

Для примера проверю том /dev/sdf1 (укажите свой sda1 или sdb2, … и т.п.)

Чтобы развеять сомнение, тот ли выбран диск, можно проверить дополнительно модель хард диска (внимательно, вместо sdf1 в команде написано sdf):

Если том примонтирован, то перед проверкой отмонтировать:

Проверка на бэдблоки:

,где /root/badblock — файлик, в который записываются номера убитых блоков.

С параметром -s  будет в % отображаться прогресс выполнения задания:

Пометка бэд блоков (в дальнейшем помеченные блоки будут игнорироваться системой):

Плохие блоки помечены, с диском можно работать.

Аналогичную процедуру желательно выполнять после форматирования новых дисков.

OpenSUSE Internet connection sharing

Internet connection sharing

Prologue

This guide assumes you have already set up your network cards with ip addresses, if you have not do this first in the YaST -> Network Devices -> Network Settings — > network card module, a good static IP for your internal NIC would be 192.168.0.254

IP forwarding

You will not be able to perform this step if you are using Network Manager and not Ifup.

Open YaST -> Network Devices -> Network Settings -> Routing and check the box marked Enable IP Forwarding

Click Finish

Select the external and internal interfaces

Open YaST — > Security & Users — > Firewall

In the Interfaces section:

Select the network card that you connect to the internet through, click change and set it to External Zone

Select the network card that is connected to the other machine(s) on your internal network that you want to share the internet to and set it to Internal Zone

Enable masquerading

Still in the Firewall YaST Module locate the Masquerading section.

Check the box labelled Masquerade Networks

Click Next and Finish

 

KVM: Starting / Stopping Guest Operating Systems With virsh Command

The virsh command can be used to mange local or remote guest operating systems. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains.

List Running VMS

Type the following command:

Sample outputs:

Shut Down A Guest

Rebooting A Guest

Forcefully Stop A Guest

Force a guest to stop with the virsh command if it is not responding or crashed

Get Information About Guest

Sample outputs:

Sample Outputs:

Файлам 644 папкам 755

Перемещаемся в верхнюю директорию.
Для директорий 755 (Каждый пользователь имеет право читать и запускать на выполнение; владелец может редактировать)

Для файлов (Все пользователи имеют право чтения; владелец может редактировать)