I'm having a problem when trying to import a user list into Zentyal 3.4.
The script I'm using is this:
#!/usr/bin/perl
use strict;
use warnings;
use EBox;
use EBox::Users::User;
EBox::init();
my $usersMod = EBox::Global->getInstance()->modInstance('users');
my $parent = $usersMod->objectFromDN('ou=Promo 2022,ou=Alumnos,'.$usersMod->ldap->dn());
my $file = 'users.csv';
open (my $USERS, $file) or die "Can't open '$file': $!";
while (my $line = <$USERS>) {
chomp ($line);
my ($username, $givenname, $surname, $password) = split(';', $line);
EBox::Users::User->create(
uid => $username,
parent => $parent,
givenname => $givenname,
surname => $surname,
password => $password,
);
}
close ($USERS);
1;
It worked perfectly the first time I used it but now it gives a "Permission denied" error when it tries to open the file.
Both the file intended to open and the script have 0777 permissions so any user should be able to do whatever the please with them.
The script needs to be run as sudo (which I did).
Solved it by the OP in the comments.
The relevant files had permissions
0777. However, the containing folder/home/angardiwas set to0700.Therefore, although I could read the files, perl didn't have permissions to read.