# How to Fix "Failed to Reset Lastlog Entry" Error When Adding WordPress/Python or any similar Site in CloudPanel

**URL:** <https://forum.hhf.technology/t/how-to-fix-failed-to-reset-lastlog-entry-error-when-adding-wordpress-python-or-any-similar-site-in-cloudpanel/377>\
**Category:** Web Technologies & Applications\
**Tags:** cloudpanel, error\
**Created:** [November 8, 2024, 6:56am UTC](https://forum.hhf.technology/t/how-to-fix-failed-to-reset-lastlog-entry-error-when-adding-wordpress-python-or-any-similar-site-in-cloudpanel/377 "2024-11-08T06:56:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [November 8, 2024, 6:56am UTC](https://forum.hhf.technology/t/how-to-fix-failed-to-reset-lastlog-entry-error-when-adding-wordpress-python-or-any-similar-site-in-cloudpanel/377/1 "2024-11-08T06:56:14Z")

</div>

# How to Fix “Failed to Reset Lastlog Entry” Error When Adding WordPress/Python or any similar Site in CloudPanel

## The Problem

When trying to add a new WordPress site in CloudPanel, you might encounter this frustrating error message:

```auto
An error has occurred, error message: Command " : /usr/bin/sudo /usr/sbin/useradd -p $(/usr/bin/openssl passwd -6 'Rh6puufsdfasduibdo3ALMh2DYH') -m 'techc' -k '/home/clp/htdocs/app/files/resources/etc/skel/site-user' -s '/bin/bash' -d '/home/techc' " failed, error message: useradd: failed to reset the lastlog entry of UID 1013: No such file or directory useradd: failed to reset the lastlog entry of UID 1013: No such file or directory

```

 ![image](https://forum-cdn.hhf.technology/original/1X/4c32036cc6275b6d720480863775599a76a106e4.png)  
 ![image](https://forum-cdn.hhf.technology/original/1X/64558c317eb0defeb1037df0a22f6f5379d8def2.png)  
 ![image](https://forum-cdn.hhf.technology/original/1X/ecab2547321a5fbc828594b8b6488ba320bb20e2.png)

This error occurs due to file permission issues with system log files, but don’t worry – it’s easy to fix!

## The Solution

Follow these steps to resolve the issue:

1. Log in to your server as the root user
2. Copy and paste these commands one by one:

```bash
chattr -i /var/log/lastlog
chattr -i /var/log/utmp
chattr -i /var/log/wtmp
chmod -R 755 /var/log/
chattr -i /var/log/utmp

```

These commands will:

- Remove the immutable attribute from system log files
- Set the correct permissions for the log directory
- Allow CloudPanel to properly create new user accounts

After running these commands, try adding your WordPress site again – it should work without any errors!

## Why This Happens

This issue isn’t actually a bug in CloudPanel, but rather a system-level permission problem that prevents CloudPanel from properly creating new user accounts. The commands above fix this by adjusting the file permissions and attributes of crucial system log files.

## Additional Tips

- Make sure you run these commands as the root user
- Double-check that your domain is properly configured in your DNS settings
- If you’re still experiencing issues, check CloudPanel’s error logs for additional information

Remember to always backup your system before making any system-level changes!

---

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [November 8, 2024, 8:24am UTC](https://forum.hhf.technology/t/how-to-fix-failed-to-reset-lastlog-entry-error-when-adding-wordpress-python-or-any-similar-site-in-cloudpanel/377/2 "2024-11-08T08:24:29Z")

</div>

![image](https://forum-cdn.hhf.technology/original/1X/5aa56dca6c9cd93120b80d426fa3292bb2f41085.jpeg)

If the above steps dont work you can try

Initial Problem:

- The system log files (`lastlog`, `utmp`, and `wtmp`) appear to be corrupted or have incorrect permissions
- These files are used to track user login history and system activity

Step-by-Step Solution:

1. **Initial Check** :

2. **Important Note** :

3. **Fix Corrupted Files** :

4. **Restart Services** :

File Purposes:

- `lastlog`: Records the last login time for each user
- `utmp`: Tracks currently logged-in users
- `wtmp`: Maintains history of all logins and logouts

These steps will create fresh log files with the correct permissions and ownership, resolving any corruption issues while maintaining proper system logging functionality.
