# General Tips

## Finding files larger than … in Linux

In order to locate any files larger than a certain size, please run the following command. The below example searches for all files larger than 500MB.

```bash
find / -size +500M
```

To display more details and sort the items in the list by size, run the following:

```bash
find / -type f -size +500M -exec du -h {}
```

## Installing Fail2Ban on a CentOS server

If you are running a predictive dialer (or any kind of Asterisk server) or a web hosting server, you have probably experienced often hacker/lamer brute force attempts. These attacks can be easily blocked by implementing optimal server configuration, using a good Firewall (i.e. SonicWall, PfSense, Tomato) etc. A very useful method of blocking brute force attacks is installing Fail2Ban, which...

## How to create a lookup / relation field in vTiger 7

When creating a fields, following changes are needed in database:
- Change `typeofdata` from the current value whatever it might be to `I~O`
- Change `uitype` from the current value to `10`
- Create a new row in `vtiger_fieldmodulerel` containing the original `fieldid` from the `vtiger_field` table, module where the data is located, module where the data should be...

## Removing a valid IP from IPTables or blacklisting a hacker IP

To remove a valid IP address from the iptables, log in via SSH and enter the following commands:

```bash
iptables-save > tmp_file
nano tmp_file
```

Remove/delete the line containing the valid IP address:

```bash
iptables-restore < tmp_file
iptables-save
```

To block an IP (example 111.222.333.444), please use the following command:

```bash
iptables -A INPUT -s 111.222.333.444 -j DROP
```

## vTiger Comments Time Format

Lot of our clients using vTiger have complained about the default Comments time format (X days ago and similar). To use a more standard timestamp, please edit the `/modules/Vtiger/helpers/util.php` file. Comment out the original `$dateTime` function and enter the following instead for imperial:

```php
public static function formatdatediffinstrings($datetime) {
    $dateTime = Vtiger_Datetime_UIType::getDBDateTimeValue($dateTime);
    return date("m-d-Y h:i:s a", strtotime($dateTime));
}
```

## vTiger 7.X CE Roles Fix

Fresh installs of self-hosted vTiger 7 come with a bug where leads and opportunities are not visible for any newly created roles unless the user is given admin privileges. Please run the following queries after making a backup of your database:

```sql
CREATE TABLE IF NOT EXISTS `vtiger_cv2group` (
    `cvid` int(25) NOT NULL,
    `groupid` int(25) NOT NULL
);
```
