Fixes in change_password for users, disabled password change
This commit is contained in:
parent
8e693ae7b6
commit
e4410d0421
3 changed files with 25 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
|||
import sys
|
||||
import argparse
|
||||
import os
|
||||
from pastafariutils.unix import add_user, del_user, change_password
|
||||
#from pastafariutils.unix import add_user, del_user, change_password
|
||||
from pathlib import Path
|
||||
from subprocess import call, DEVNULL
|
||||
import json
|
||||
|
|
@ -23,6 +23,7 @@ parser.add_argument('--ssh_pub_key_file', help='The ssh pub key of the unix user
|
|||
|
||||
args=parser.parse_args()
|
||||
|
||||
"""
|
||||
if args.password:
|
||||
|
||||
password_user=args.password
|
||||
|
|
@ -35,7 +36,7 @@ if args.password:
|
|||
else:
|
||||
|
||||
print('Changed password succesfully...\n')
|
||||
|
||||
"""
|
||||
|
||||
if args.ssh_pub_key_file:
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,27 @@ if linux_distro=='arch':
|
|||
print('Error, cannot add utilities for archlinux')
|
||||
exit(1)
|
||||
|
||||
# Add selinux permisions
|
||||
|
||||
if call("sudo getenforce", shell=True)==0:
|
||||
|
||||
# If selinux enabled, set permissions to /home/hosting/sites for sites.
|
||||
if call("setenforce 0", shell=True) > 0:
|
||||
print('Error, cannot disable selinux...')
|
||||
exit(1)
|
||||
|
||||
#with open('/etc/sysconfig/selinux') as f:
|
||||
|
||||
if linux_distro=='rocky' or linux_distro=='fedora' or linux_distro=='almalinux':
|
||||
|
||||
if call("sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config", shell=True) > 0:
|
||||
print('Error, cannot disable selinux in file /etc/selinux/config...')
|
||||
exit(1)
|
||||
|
||||
if call("sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/sysconfig/selinux", shell=True) > 0:
|
||||
print('Error, cannot disable selinux in file /etc/sysconfig/selinux...')
|
||||
exit(1)
|
||||
|
||||
"""
|
||||
else:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue