Skip to content
0
  • Recent
  • Tags
  • Popular
  • Search
  • ads.txt
  • Recent
  • Tags
  • Popular
  • Search
  • ads.txt
Collapse
Lime-it.us
R

rick

@rick
administrators
About
Posts
93
Topics
71
Shares
0
Groups
1
Followers
1
Following
1

Posts

Recent Best Controversial

  • Locating files with the find command
    R rick
    Jan 1, 2016, 4:33 PM

    Locating files using the find command

    The find command is a powerful utility that allows the user to find files located in the file system via criteria such as the file name, when file was last accessed, when the file status was last changed, the file’s permissions, owner, group, size.


    Find a file “foo.bar” that exists somewhere in the file system

    find / -name foo.bar -print

    On most platforms the -print is optional, however, on some systems nothing will be output without it. Without specifications find searches recursively through all directories.


    Find a file without searching network or mounted file systems

    find / -name foo.bar -print -xdev

    This is useful if you have network drives that you know the file would not be located on. “-mount” does the same thing as “-xdev” for compatibility with other versions of find.


    Find a file without showing “Permission Denied” messages

    find / -name foo.bar -print 2>/dev/null

    When find tries to search a directory or file that you do not have permission to read the message “Permission Denied” will be output to the screen. The 2>/dev/null option sends these messages to /dev/null so that the found files are easily viewed.


    Find a file, who’s name ends with .bar, within the current directory and only search 2 directories deep

    find . -name *.bar -maxdepth 2 -print


    Search directories “./dir1” and “./dir2” for a file "foo.bar

    find ./dir1 ./dir2 -name foo.bar -print


    Search for files that are owned by the user “skippie”

    find /some/directory -user skippie -print

    The files output will belong to the user “skippie”. Similar criteria are -uid to search for a user by their numerical id, -group to search by a group name, and -gid to search by a group id number.


    Find a file that is a certain type. “-type l” searches for symbolic links

    find /any/directory -type l -print


    Several types of files can be searched for: Several types of files can be searched for:

    • b block (buffered) special

    • c character (unbuffered) special

    • d directory

    • p named pipe (FIFO)

    • f regular file

    • l symbolic link

    • s socket


    Search for directories that contain the phrase “foo” but do not end in “.bar”

    find . -name '*foo*' ! -name '*.bar' -type d -print

    The “!” allows you to exclude results that contain the phrases following it.

    find becomes extremely useful when combined with other commands. One such combination would be using find and grep together.

    find ~/documents -type f -name '*.txt' \ -exec grep -s DOGS {} \; -print

    Linux Systems Guides

  • Move files to and from server scp command
    R rick
    Jan 1, 2016, 4:04 PM

    SCP or (secure copy) allows you to move files even entire directories to, or from local and or remote hosts, using the same authentication and securtiy levels as SSH.

    Copy the file “foobar.txt” from a remote host to the local host

        $ scp username@site.com:foobar.txt /local/directory
    

    Copy the file “foobar.txt” from the local host to a remote host

        $ scp foobar.txt username@remotehost.com:/path/to/directory
    

    Copy the directory “foo” from the local host to a remote host’s directory “bar”

        $ scp -r foo username@remotehost.com:/remote/directory/bar
    

    Copy the file “foobar.txt” from remote host “site1.com” to remote host “site2.com”

        $ scp username@site1.com:/remote/directory/foobar.txt \username@site2.com:/remote/directory/
    

    Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host

        $ scp foo.txt bar.txt username@site.com:~
    

    Copy the file “foobar.txt” from the local host to a remote host using port 1000 (or whatever ssh port your running on)

        $ scp -P 1000 foobar.txt username@site.com:/remote/directory
    

    Copy multiple files from the remote host to your current directory on the local host

        $ scp username@site.com:/remote/directory/\{a,b,c\} .
    
        $ scp username@site.com:~/\{foo.txt,bar.txt\} .
    

    By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed on slower connections. This can be done by using option -c blowfish in the command line.

    $ scp -c blowfish file.txt username@site.com:~
    

    Use the -C option for compression, and a bit of speed. If you have a fast connection you might not notice much of a difference. However it is a bit more CPU intensive due to the algorithms used to generate the encryption.

    Blowfish scp example:

        $ scp -c blowfish -C file.txt username@site.com:~
    
    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Jan 3, 2012, 6:06 PM

    Listing directory contents

    ls - To list the contents of a directory

    Usage: ls [flags]

    Example: ls (To list the current directory)

    Example: ls /tmp (To list the contents of /tmp)

    Example: ls -a (To list hidden files)

    Example: ls -l (To list file/directory permissions and file sizes)

    Example: ls -al /tmp(To list all files and permissions in /tmp)

    Example: ls -il (To get the inode number, permissions, owner, file sizes, UID and timestamps of all files in current directory)

    For more information, in a terminal, type man ls

    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Dec 30, 2011, 3:06 AM

    Deleting files

    To delete a file you must first have write permission to it. Once you have write permission, in a terminal run:
    rm filename\

    There is no “Recycle Bin” in Linux so once you delete a file, it’s gone for good.

    Being safe, find the files first and actually look at what you will be deleting! find . -type f -name foo\*

    When removing files, you may use an astrix “*” as a wildcard flag to remove certain files, for example if I wanted to remove all files that began with “foo” , I would run:

    find . -type f -name foo\* -exec rm {} \;

    If anyone tells you to run rm -rf / as root, DO NOT LISTEN TO THEM. Running this command will delete all the files/directories on your Linux system. And render the machine completely useless with zero chance of recovery!


    You should not be running as root to begin with! Learn to use a secondary user, and as well the “su” command or “Super User” as general usage dictates.


    Deleting directories
    If you have ownership to the directory and the directory is empty, you can simply type

    rmdir directoryname to remove the directory.

    If the directory is not empty and you wish to simply delete it and all its contents, run:

    rm -rf directoryname\[/code\] Please be careful with the -rf flag, as it will remove everything in the specified directory including sub directories. With root access and the rm -rf command you can wipe out your entire system if you make an error.

    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Dec 30, 2011, 2:44 AM

    Editing files
    The default editor installed with most all distros of linux is VIM , or

    vi filename

    Vim is an advanced command line editor, you should consider learning the commands.

    You can however also use nano To edit a file with nano, simply run:

    nano filename

    This will open up the file and allow to you edit the file. At the bottom of the screen you will notice the various commands that you have access to with nano. If you wish to save the file and exit, simply hold down the control key and hit the x key on your keyboard.

    You will be asked to confirm this edit, if you have permissions to do so, once you confirm by typeing y, the file will be edited and nano will exit.

    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Dec 29, 2011, 9:27 PM

    Renaming files
    mv - Command used to move or rename files
    Usage: mv file location
    Usage: mv filename::newfilename

    Example: mv tmp/site-logo.png /tmp/lime-it.png

    Read the manual: man mv


    Moving files
    mv - Used to move or rename files
    Usage: mv file location (to move)

    Example:mv index.html /var/www/index.html

    For more information, in a terminal and read the manual pages, type: man mv

    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Dec 29, 2011, 9:02 PM

    Downloading a file using the terminal command wget

    First cd to the tmp directory

    cd /tmp

    Example: wget http://news.lime-it.us/uploads/system/site-logo.png


    Copy files

    cp - Used to copy files or directories from one location to another. We can use the above example for this.

    Example: cp /tmp/site-logo.png /var/www/httpdocs

    [as httpdocs is your root web directory]


    To move ALL files from one directory to another:

    Example: cp /tmp/files/* /var/www/httpdocs

    (the “*” tells the machine to copy everything in /tmp/files to /var/www/)


    Check your man pages for more information on the cp command**

    man cp

    Linux Systems Guides

  • Basic Linux Terminal Commands
    R rick
    Dec 27, 2011, 3:10 AM

    Adding a user
    While logged in as root, type in the shell:

    replace username with the username you wish

    adduser username
    

    Deleting a user:
    While logged in as root, type replace username with the user name you wish to delete.

    userdel username
    

    Change login password
    To set the password for a specific user, replace username with the name of the user. By typing simply:

      passwd username
    

    To change the current password for the user you are logged in as:

    passwd
    

    Change directories

    cd - Used to Change Directories

    Usage: cd /[directory]
    Example:

    cd /tmp
    

    Example:

    cd ../
    

    (moves back one directory)

    Move to your home directory:

    cd
    

    Check the man pages for more info:

    man cd
    
    Linux Systems Guides
FreeBSD Notes
  • rickR
    rick
    6 days ago

    email-scam.png

    read more

  • rickR
    rick
    6 days ago

    cloud-scam.png

    read more

  • rickR
    rick
    Apr 6, 2025, 4:07 PM

    Create a shell script that will dump the Redis database

    cd ~ mkdir redi-backups-script cd redis-backups-script nano redis_backups-script.sh

    Paste the script below:

    #!/bin/bash rdb_file="/Place-directory-of-rdb-here/redis/dump.rdb" redis_cli="/usr/bin/redis-cli" DIR=`date +%d-%m-%y` DEST=~/redis_backups/$DIR mkdir $DEST echo save| $redis_cli exit 1

    Set script to executable:

    chmod +x ~/scripts/redis_backups-script.sh

    Create a cron to run daily:

    Then create a cron job to run the script every day at midnight:

    crontab -e 0 0 * * * ~/redis-backups-script/redis_backup.sh

    Restore RDB backup

    Disable Append Only in the config:

    nano /etc/redis/redis.conf appendonly no

    Stop redis:

    sudo service redis-server stop

    Restore the redis backup:

    rename the rdb file you wish sudo cp /home/redis/dump.rdb /home/redis/dump.rdb.bak

    You can then copy the backup rdb file as follows:

    sudo cp /redis_backups/------/dump.rdb /home/redis/dump.rdb

    Apply the proper permissions to the dump.rdb file:

    sudo chmod 660 /home/redis/dump.rdb

    Re-starting Redis server

    sudo service redis-server start
    read more

  • rickR
    rick
    Mar 22, 2025, 10:30 PM

    Install Zabbix 7.2 repo

    wget https://repo.zabbix.com/zabbix/7.2/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.2+debian12_all.deb

    zab1.png

    dpkg -i zabbix-release_latest_7.2+debian12_all.deb

    zab2.png

    Update repos

    apt update

    zab3.png

    Install Zabbix server and frontend

    apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2

    zab4.png

    Install plugins

    apt install zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql zabbix-agent2-plugin-postgresql

    zab5.png

    Install mysql

    wget https://dev.mysql.com/get/mysql-apt-config_0.8.30-1_all.deb

    zab-6sql.png

    sudo dpkg -i mysql-apt-config_0.8.30-1_all.deb

    Error on this new install, where lsb-release is not installed

    zab7sql-error.png

    apt-get install lsb-release

    zab7lsb.png

    Try again…

    dpkg -i mysql-apt-config_0.8.30-1_all.deb

    Error, gnupg not installed

    zab7gnupgerror.png

    apt install gnupg2

    zab7gnupg2.png

    Give it another go…

    dpkg -i mysql-apt-config_0.8.30-1_all.deb

    zab7sqltui.png

    zab7sql.png

    I had to list upgradable packages :

    apt-list --upgradable

    Which spit out : mysql-common/unknown 8.4.4-1debian12 all [upgradable from: 5.8+1.1.0]

    Then installed mysql-common

    apt-get install mysql-common

    zabbix-7-sqlgoofs.png

    Had to uninstall Mariadb to resolve these conflicts

    apt remove mariadb-client-core

    Then install mysql-server:

    apt install mysql-server

    zab7-sql-common.png

    zab7-sql-rootpass.png

    Enter your password, twice

    Now enter mysql by typing :

    mysql -u root -p

    zab7-mysql-enter.png

    Enter the following command individually Where ‘password’ is where you type in your actual own password

    mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by 'password'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> set global log_bin_trust_function_creators = 1; mysql> quit;

    Populate the database with zabbix script

    zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix mysql --u root -p set global log_bin_trust_function_creators = 0; quit;

    Edit file /etc/zabbix/zabbix_server.conf You can use nano

    nano /etc/zabbix/zabbix_server.conf

    Uncomment the DBPassword section, and type your password

    zabbix-dbpassword.png

    Then hold ctrl and tap x, it will ask if you want to save changes.

    Enable services:

    systemctl enable zabbix-server zabbix-agent2 nginx php8.2-fpm systemctl restart zabbix-server zabbix-agent2 nginx php8.2-fpm

    Check that zabbix service has started

    journalctl -xeu zabbix-server.service

    zabbix7startjob.png

    Delete the 'default site in nginx

    sudo rm -rf /etc/nginx/sites-enabled/default

    Make sure the symbolic link to the zabbix nginx file is present

    ln -s /etc/zabbix/nginx.conf /etc/nginx/sites-enabled/zabbix.conf

    Check that the zabbix nginx file is in the includes in nginx config

    nano /etc/nginx/nginx.conf

    Look for :

    include /etc/nginx/sites-enabled/*

    Now restart nginx

    systemctl restart nginx

    Hit the browser and type in the IP (or URL that you may have put in the zabbix nginx config file)

    zabbix.png

    Make sure to configure locales

    zabbix-locales.png

    sudo dpkg-reconfigure locales

    zabbixlocalestui.png

    zabbix-locales-2.png

    zabbix-locales-command.png

    Reboot the system

    sudo shutdown -r now

    zabbix-utf.png

    Add your database password

    zabbix-db.png

    Add a server name

    zabbix-servername.png

    zabbix-summary.png

    zabbix-config.png

    The default username is Admin, and the password is zabbix

    zabbix-home.png

    read more

  • rickR
    rick
    Nov 3, 2024, 7:29 PM
    Unable to negotiate with 10.10.1.35 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

    While attempting ssh this error is generally due to mismatched versions of ssh, where an up to date version is attempting to access an older version

    Add the following to your command :

    The proper way:

    ssh -o KexAlgorithms=diffie-hellman-group14-sha1 -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    The cheap way:

    Example :

    ssh -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    or ssh -oHostKeyAlgorithms=+ssh-dss user@10.10.1.35

    This can be added to the ~/.ssh/config file

    Host my-server HostName 10.10.1.35 HostKeyAlgorithms=+ssh-dss
    read more
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post