Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-02 Thread akhiezer
> From: Bruce Dubbs <bruce.du...@gmail.com>
> Date: Thu, 1 Dec 2016 11:18:59 -0600
> Subject: Re: [blfs-dev] Sendmail page - Think we are missing a command
>
.
.
> # Put in place as root
> install -m755 /etc/mail


(install -d ...)


> install -m644 aliases /etc/mail/aliases
>



akh





--
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread Bruce Dubbs

Pierre Labastie wrote:


If I use "su", my umask as root is the same as that of pierre (0002)
If I use "su -", umask is correctly set to 0022 (but of course the working
directory is  changed to /root)
what I use in my scripts is
sudo -E sh << ROOT_EOF

ROOT_EOF



If I do that, umask is 0022, and CWD is not changed. I cannot understand
what makes the difference with su (I do not use this command, that's why...)


su without the dash switches the user without affecting the environment. 
With the dash, does the same as if root logged.  The man page fo rsu says:


"The optional argument - may be used to provide an environment similar to 
what the user would expect had the user logged in directly."


sudo -E says"

Indicates to the security policy that the user wishes to preserve their
existing environment variables. The security policy may return an error if
the user does not have permission to preserve the environment.

sudo does not change the umask by default.

I agree that install would be the better instruction for sendmail.  I have 
found the better way to handle 'here' documents is to do something like:


# Create the file locally in build phase -- does not need to be root
cat > aliases << "EOF"
postmaster: root
MAILER-DAEMON: root

EOF

# Put in place as root
install -m755 /etc/mail
install -m644 aliases /etc/mail/aliases

I do not think that owner and group need to be specified because we would 
be running as root.


  -- Bruce

--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread Pierre Labastie

On 01/12/2016 10:38, Douglas R. Reno wrote:



On Thu, Dec 1, 2016 at 3:33 AM, Pierre Labastie 
> wrote:


On 01/12/2016 07:56, Douglas R. Reno wrote:

Pierre Labastie wrote:

On 01/12/2016 04:38, Douglas R. Reno wrote:

Hello,

Upon trying to run the newaliases command in the
Configuration Information page, I'll get the following
error:

newaliases: cannot open /etc/mail/aliases: Group
writable file

For context, these are the commands that I ran
(similar to the book):

renodr [ /sources ]$ su
Password:
root [ /sources ]# echo $(hostname) >
/etc/mail/local-host-names
root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> postmaster: root
> MAILER-DAEMON: root
>
> EOF
root [ /sources ]# newaliases
newaliases: cannot open /etc/mail/aliases: Group
writable file
root [ /sources ]#

In order to fix this, I had to run something similar to:

root [ /sources ]# chmod -v 644 /etc/mail/aliases
mode of '/etc/mail/aliases' changed from 0664
(rw-rw-r--) to 0644 (rw-r--r--)
root [ /sources ]# newaliases
/etc/mail/aliases: 2 aliases, longest 4 bytes, 31
bytes total

I propose adding the "chmod -v 644 /etc/mail/aliases"
command to the book.

I'd like to ask for comments / suggestions before I
put it in there myself.

I guess it is an "umask" problem. Normally, if your bash
startup files are set as in the book, umask should be 022
when you are root, and no additional instruction should be
necessary. OTOH, maybe su does not run the bash startup
files...

Regards
Pierre

As far as I can see after tracing it for a little bit, I can't
find a line in /root/.bashrc, /etc/profile, /etc/bashrc, or
/root/.bash_profile that accomplishes that. However, we do
execute it in /etc/profile.d/umask.sh.


When I am "su"ed to root, my umask is 0022. If I use my normal
user, my umask is 0002.

root [ ~ ]# umask
0022

renodr [ /sources ]$ umask
0002

I just verified that all of my bash startup files are
identical to the ones in the book.

If I use "su", my umask as root is the same as that of pierre (0002)
If I use "su -", umask is correctly set to 0022 (but of course the
working directory is  changed to /root)
what I use in my scripts is
sudo -E sh << ROOT_EOF

ROOT_EOF
If I do that, umask is 0022, and CWD is not changed. I cannot
understand what makes the difference with su (I do not use this
command, that's why...)

Pierre


Hmm...

I can try what you are doing for sudo. In my case, just running "sudo 
cat... << EOF" gives me a permission denied error (if I recall 
correctly, I haven't tried that in a long time).


Here's an explanation as to why "su - " and "su" do different things.

"su - " forces a new login session to be spawned I think, which 
is why it resets the working directory to the new user's home 
directory. If one just uses "su" or "su ", I think that it tells 
it to change to that user but preserve the current environment.
Actually umask is not really in the "environment".The difference in 
behavior comes from the difference in default implementations of sudo 
and su.

From "man sudoers", about the variable "umask":
--
Umask to use when running the command.  Negate this
option or set it to 0777 to preserve the user's umask.
The actual umask that is used will be the union of the
user's umask and the value of the umask option, which
defaults to 0022.  This guarantees that sudo never low‐
ers the umask when running a command.  Note: on systems
that use PAM, the default PAM configuration may specify
its own umask which will override the value set in
sudoers.
--

"man su" does not have much to say about umask.
"man login.defs" has more, but I guess systemd users have PAM, which 
overrides all that:

--
   UMASK (number)
   The file mode creation mask is initialized to this value. If not
   specified, the mask will be initialized to 022.

   useradd and newusers use this mask to set the mode of the home
   directory they create

   It is also used by pam_umask as the default umask value.
--
It is explicitly said at the end of that man page that su does not use 
UMASK.
So I understand that, with su, you get whatever umask is set by the 
shell. Since "su" (not "su -") 

Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread Douglas R. Reno
On Thu, Dec 1, 2016 at 3:33 AM, Pierre Labastie 
wrote:

> On 01/12/2016 07:56, Douglas R. Reno wrote:
>
>> Pierre Labastie wrote:
>>
>>> On 01/12/2016 04:38, Douglas R. Reno wrote:
>>>
 Hello,

 Upon trying to run the newaliases command in the Configuration
 Information page, I'll get the following error:

 newaliases: cannot open /etc/mail/aliases: Group writable file

 For context, these are the commands that I ran (similar to the book):

 renodr [ /sources ]$ su
 Password:
 root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
 root [ /sources ]# cat > /etc/mail/aliases << "EOF"
 > postmaster: root
 > MAILER-DAEMON: root
 >
 > EOF
 root [ /sources ]# newaliases
 newaliases: cannot open /etc/mail/aliases: Group writable file
 root [ /sources ]#

 In order to fix this, I had to run something similar to:

 root [ /sources ]# chmod -v 644 /etc/mail/aliases
 mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644
 (rw-r--r--)
 root [ /sources ]# newaliases
 /etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total

 I propose adding the "chmod -v 644 /etc/mail/aliases" command to the
 book.

 I'd like to ask for comments / suggestions before I put it in there
 myself.

 I guess it is an "umask" problem. Normally, if your bash startup files
>>> are set as in the book, umask should be 022 when you are root, and no
>>> additional instruction should be necessary. OTOH, maybe su does not run the
>>> bash startup files...
>>>
>>> Regards
>>> Pierre
>>>
>> As far as I can see after tracing it for a little bit, I can't find a
>> line in /root/.bashrc, /etc/profile, /etc/bashrc, or /root/.bash_profile
>> that accomplishes that. However, we do execute it in
>> /etc/profile.d/umask.sh.
>>
>>
>> When I am "su"ed to root, my umask is 0022. If I use my normal user, my
>> umask is 0002.
>>
>> root [ ~ ]# umask
>> 0022
>>
>> renodr [ /sources ]$ umask
>> 0002
>>
>> I just verified that all of my bash startup files are identical to the
>> ones in the book.
>>
>> If I use "su", my umask as root is the same as that of pierre (0002)
> If I use "su -", umask is correctly set to 0022 (but of course the working
> directory is  changed to /root)
> what I use in my scripts is
> sudo -E sh << ROOT_EOF
> 
> ROOT_EOF
> If I do that, umask is 0022, and CWD is not changed. I cannot understand
> what makes the difference with su (I do not use this command, that's why...)
>
> Pierre
>
>
Hmm...

I can try what you are doing for sudo. In my case, just running "sudo
cat... << EOF" gives me a permission denied error (if I recall correctly, I
haven't tried that in a long time).

Here's an explanation as to why "su - " and "su" do different things.

"su - " forces a new login session to be spawned I think, which is
why it resets the working directory to the new user's home directory. If
one just uses "su" or "su ", I think that it tells it to change to
that user but preserve the current environment.
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread akhiezer
> From: "Douglas R. Reno" <renodr2...@gmail.com>
> Date: Thu, 1 Dec 2016 03:17:23 -0600
> Subject: Re: [blfs-dev] Sendmail page - Think we are missing a command
>
> On Thu, Dec 1, 2016 at 2:53 AM, akhiezer <lf...@cruziero.com> wrote:
>
> > > From: "Douglas R. Reno" <ren...@linuxfromscratch.org>
> > > Date: Thu, 1 Dec 2016 00:56:27 -0600
> > > Subject: Re: [blfs-dev] Sendmail page - Think we are missing a command
> > >
> > > Pierre Labastie wrote:
> > > > On 01/12/2016 04:38, Douglas R. Reno wrote:
> > > >> Hello,
> > > >>
> > > >> Upon trying to run the newaliases command in the Configuration
> > > >> Information page, I'll get the following error:
> > > >>
> > > >> newaliases: cannot open /etc/mail/aliases: Group writable file
> > > >>
> > > >> For context, these are the commands that I ran (similar to the book):
> > > >>
> > > >> renodr [ /sources ]$ su
> > > >> Password:
> > > >> root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
> > > >> root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> > > >> > postmaster: root
> > > >> > MAILER-DAEMON: root
> > > >> >
> > > >> > EOF


Did /etc/mail/aliases somehow exist prior to the above here-doc command;
and if yes, then was it somehow created by your own, non-root, user;
and would that be why it was 0664 .


What happens if you do:

renodr$ su -
root# cat > /tmp/SOME_FILE_THAT_YOU_KNOW_DOES_NOT_YET_EXIST <<"EOF"
test
EOF
root#

What perms does '/tmp/SOME_FILE_THAT_YOU_KNOW_DOES_NOT_YET_EXIST' have?


((NB that one would of course 'more-properly' use mktemp for gen such
a new file.))


> > > >> root [ /sources ]# newaliases
> > > >> newaliases: cannot open /etc/mail/aliases: Group writable file
> > > >> root [ /sources ]#
> > > >>
> > > >> In order to fix this, I had to run something similar to:
> > > >>
> > > >> root [ /sources ]# chmod -v 644 /etc/mail/aliases
> > > >> mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644
> > > >> (rw-r--r--)
> > > >> root [ /sources ]# newaliases
> > > >> /etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total
> > > >>
> > > >> I propose adding the "chmod -v 644 /etc/mail/aliases" command to the
> > > >> book.
> >
> >
> > Normally you do want such files 0644, and the corresp generated .db files
> > as 0640 : but the root of the problem is why the 0664 appeared at all ...
> >
> >
> > > >>
> > > >> I'd like to ask for comments / suggestions before I put it in there
> > > >> myself.
> > > >>
> > > > I guess it is an "umask" problem.
> >
> >
> >  ...  +1
> >
> >
> > > >  Normally, if your bash startup files
> > > > are set as in the book, umask should be 022 when you are root, and no
> > > > additional instruction should be necessary. OTOH, maybe su does not
> > > > run the bash startup files...
> > > >
> > > As far as I can see after tracing it for a little bit, I can't find a
> > > line in /root/.bashrc, /etc/profile, /etc/bashrc, or /root/.bash_profile
> > > that accomplishes that. However, we do execute it in
> > > /etc/profile.d/umask.sh.
> > >
> > >
> > > When I am "su"ed to root, my umask is 0022. If I use my normal user, my
> > > umask is 0002.
> > >
> > > root [ ~ ]# umask
> > > 0022
> > >
> > > renodr [ /sources ]$ umask
> > > 0002
> > >
> >
> >
> > And if you do 'su -' ?
> >
> >
> renodr [ /sources ]$ su - root
> Password:
> root [ ~ ]# umask
> 0022
> root [ ~ ]#
>
>
>
> > > I just verified that all of my bash startup files are identical to the
> > > ones in the book.
> > >
.
.
>



akh





--
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread Pierre Labastie

On 01/12/2016 07:56, Douglas R. Reno wrote:

Pierre Labastie wrote:

On 01/12/2016 04:38, Douglas R. Reno wrote:

Hello,

Upon trying to run the newaliases command in the Configuration 
Information page, I'll get the following error:


newaliases: cannot open /etc/mail/aliases: Group writable file

For context, these are the commands that I ran (similar to the book):

renodr [ /sources ]$ su
Password:
root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> postmaster: root
> MAILER-DAEMON: root
>
> EOF
root [ /sources ]# newaliases
newaliases: cannot open /etc/mail/aliases: Group writable file
root [ /sources ]#

In order to fix this, I had to run something similar to:

root [ /sources ]# chmod -v 644 /etc/mail/aliases
mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644 
(rw-r--r--)

root [ /sources ]# newaliases
/etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total

I propose adding the "chmod -v 644 /etc/mail/aliases" command to the 
book.


I'd like to ask for comments / suggestions before I put it in there 
myself.


I guess it is an "umask" problem. Normally, if your bash startup 
files are set as in the book, umask should be 022 when you are root, 
and no additional instruction should be necessary. OTOH, maybe su 
does not run the bash startup files...


Regards
Pierre
As far as I can see after tracing it for a little bit, I can't find a 
line in /root/.bashrc, /etc/profile, /etc/bashrc, or 
/root/.bash_profile that accomplishes that. However, we do execute it 
in /etc/profile.d/umask.sh.



When I am "su"ed to root, my umask is 0022. If I use my normal user, 
my umask is 0002.


root [ ~ ]# umask
0022

renodr [ /sources ]$ umask
0002

I just verified that all of my bash startup files are identical to the 
ones in the book.



If I use "su", my umask as root is the same as that of pierre (0002)
If I use "su -", umask is correctly set to 0022 (but of course the 
working directory is  changed to /root)

what I use in my scripts is
sudo -E sh << ROOT_EOF

ROOT_EOF
If I do that, umask is 0022, and CWD is not changed. I cannot understand 
what makes the difference with su (I do not use this command, that's why...)


Pierre

--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread Douglas R. Reno
On Thu, Dec 1, 2016 at 2:53 AM, akhiezer <lf...@cruziero.com> wrote:

> > From: "Douglas R. Reno" <ren...@linuxfromscratch.org>
> > Date: Thu, 1 Dec 2016 00:56:27 -0600
> > Subject: Re: [blfs-dev] Sendmail page - Think we are missing a command
> >
> > Pierre Labastie wrote:
> > > On 01/12/2016 04:38, Douglas R. Reno wrote:
> > >> Hello,
> > >>
> > >> Upon trying to run the newaliases command in the Configuration
> > >> Information page, I'll get the following error:
> > >>
> > >> newaliases: cannot open /etc/mail/aliases: Group writable file
> > >>
> > >> For context, these are the commands that I ran (similar to the book):
> > >>
> > >> renodr [ /sources ]$ su
> > >> Password:
> > >> root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
> > >> root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> > >> > postmaster: root
> > >> > MAILER-DAEMON: root
> > >> >
> > >> > EOF
> > >> root [ /sources ]# newaliases
> > >> newaliases: cannot open /etc/mail/aliases: Group writable file
> > >> root [ /sources ]#
> > >>
> > >> In order to fix this, I had to run something similar to:
> > >>
> > >> root [ /sources ]# chmod -v 644 /etc/mail/aliases
> > >> mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644
> > >> (rw-r--r--)
> > >> root [ /sources ]# newaliases
> > >> /etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total
> > >>
> > >> I propose adding the "chmod -v 644 /etc/mail/aliases" command to the
> > >> book.
>
>
> Normally you do want such files 0644, and the corresp generated .db files
> as 0640 : but the root of the problem is why the 0664 appeared at all ...
>
>
> > >>
> > >> I'd like to ask for comments / suggestions before I put it in there
> > >> myself.
> > >>
> > > I guess it is an "umask" problem.
>
>
>  ...  +1
>
>
> > >  Normally, if your bash startup files
> > > are set as in the book, umask should be 022 when you are root, and no
> > > additional instruction should be necessary. OTOH, maybe su does not
> > > run the bash startup files...
> > >
> > As far as I can see after tracing it for a little bit, I can't find a
> > line in /root/.bashrc, /etc/profile, /etc/bashrc, or /root/.bash_profile
> > that accomplishes that. However, we do execute it in
> > /etc/profile.d/umask.sh.
> >
> >
> > When I am "su"ed to root, my umask is 0022. If I use my normal user, my
> > umask is 0002.
> >
> > root [ ~ ]# umask
> > 0022
> >
> > renodr [ /sources ]$ umask
> > 0002
> >
>
>
> And if you do 'su -' ?
>
>
renodr [ /sources ]$ su - root
Password:
root [ ~ ]# umask
0022
root [ ~ ]#



> > I just verified that all of my bash startup files are identical to the
> > ones in the book.
> >
>
>
> The wider picture here is that one should use 'install ...' with explicit
> permissions, ownership, group, full src-path, full tgt-path,  - thus
> reducing or eliminating implicit intentions; and then verify that what
> was intended, has actually been put in place.
>
>
Yeah, that definitely would be an interesting idea.
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-12-01 Thread akhiezer
> From: "Douglas R. Reno" <ren...@linuxfromscratch.org>
> Date: Thu, 1 Dec 2016 00:56:27 -0600
> Subject: Re: [blfs-dev] Sendmail page - Think we are missing a command
>
> Pierre Labastie wrote:
> > On 01/12/2016 04:38, Douglas R. Reno wrote:
> >> Hello,
> >>
> >> Upon trying to run the newaliases command in the Configuration 
> >> Information page, I'll get the following error:
> >>
> >> newaliases: cannot open /etc/mail/aliases: Group writable file
> >>
> >> For context, these are the commands that I ran (similar to the book):
> >>
> >> renodr [ /sources ]$ su
> >> Password:
> >> root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
> >> root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> >> > postmaster: root
> >> > MAILER-DAEMON: root
> >> >
> >> > EOF
> >> root [ /sources ]# newaliases
> >> newaliases: cannot open /etc/mail/aliases: Group writable file
> >> root [ /sources ]#
> >>
> >> In order to fix this, I had to run something similar to:
> >>
> >> root [ /sources ]# chmod -v 644 /etc/mail/aliases
> >> mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644 
> >> (rw-r--r--)
> >> root [ /sources ]# newaliases
> >> /etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total
> >>
> >> I propose adding the "chmod -v 644 /etc/mail/aliases" command to the 
> >> book.


Normally you do want such files 0644, and the corresp generated .db files
as 0640 : but the root of the problem is why the 0664 appeared at all ...


> >>
> >> I'd like to ask for comments / suggestions before I put it in there 
> >> myself.
> >>
> > I guess it is an "umask" problem.


 ...  +1


> >  Normally, if your bash startup files 
> > are set as in the book, umask should be 022 when you are root, and no 
> > additional instruction should be necessary. OTOH, maybe su does not 
> > run the bash startup files...
> >
> As far as I can see after tracing it for a little bit, I can't find a 
> line in /root/.bashrc, /etc/profile, /etc/bashrc, or /root/.bash_profile 
> that accomplishes that. However, we do execute it in 
> /etc/profile.d/umask.sh.
>
>
> When I am "su"ed to root, my umask is 0022. If I use my normal user, my 
> umask is 0002.
>
> root [ ~ ]# umask
> 0022
>
> renodr [ /sources ]$ umask
> 0002
>


And if you do 'su -' ?


> I just verified that all of my bash startup files are identical to the 
> ones in the book.
>


The wider picture here is that one should use 'install ...' with explicit
permissions, ownership, group, full src-path, full tgt-path,  - thus
reducing or eliminating implicit intentions; and then verify that what
was intended, has actually been put in place.



akh





--
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-11-30 Thread Douglas R. Reno

Pierre Labastie wrote:

On 01/12/2016 04:38, Douglas R. Reno wrote:

Hello,

Upon trying to run the newaliases command in the Configuration 
Information page, I'll get the following error:


newaliases: cannot open /etc/mail/aliases: Group writable file

For context, these are the commands that I ran (similar to the book):

renodr [ /sources ]$ su
Password:
root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> postmaster: root
> MAILER-DAEMON: root
>
> EOF
root [ /sources ]# newaliases
newaliases: cannot open /etc/mail/aliases: Group writable file
root [ /sources ]#

In order to fix this, I had to run something similar to:

root [ /sources ]# chmod -v 644 /etc/mail/aliases
mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644 
(rw-r--r--)

root [ /sources ]# newaliases
/etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total

I propose adding the "chmod -v 644 /etc/mail/aliases" command to the 
book.


I'd like to ask for comments / suggestions before I put it in there 
myself.


I guess it is an "umask" problem. Normally, if your bash startup files 
are set as in the book, umask should be 022 when you are root, and no 
additional instruction should be necessary. OTOH, maybe su does not 
run the bash startup files...


Regards
Pierre
As far as I can see after tracing it for a little bit, I can't find a 
line in /root/.bashrc, /etc/profile, /etc/bashrc, or /root/.bash_profile 
that accomplishes that. However, we do execute it in 
/etc/profile.d/umask.sh.



When I am "su"ed to root, my umask is 0022. If I use my normal user, my 
umask is 0002.


root [ ~ ]# umask
0022

renodr [ /sources ]$ umask
0002

I just verified that all of my bash startup files are identical to the 
ones in the book.


--
Douglas R. Reno
--LFS/BLFS systemd maintainer

--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: [blfs-dev] Sendmail page - Think we are missing a command

2016-11-30 Thread Pierre Labastie

On 01/12/2016 04:38, Douglas R. Reno wrote:

Hello,

Upon trying to run the newaliases command in the Configuration 
Information page, I'll get the following error:


newaliases: cannot open /etc/mail/aliases: Group writable file

For context, these are the commands that I ran (similar to the book):

renodr [ /sources ]$ su
Password:
root [ /sources ]# echo $(hostname) > /etc/mail/local-host-names
root [ /sources ]# cat > /etc/mail/aliases << "EOF"
> postmaster: root
> MAILER-DAEMON: root
>
> EOF
root [ /sources ]# newaliases
newaliases: cannot open /etc/mail/aliases: Group writable file
root [ /sources ]#

In order to fix this, I had to run something similar to:

root [ /sources ]# chmod -v 644 /etc/mail/aliases
mode of '/etc/mail/aliases' changed from 0664 (rw-rw-r--) to 0644 
(rw-r--r--)

root [ /sources ]# newaliases
/etc/mail/aliases: 2 aliases, longest 4 bytes, 31 bytes total

I propose adding the "chmod -v 644 /etc/mail/aliases" command to the 
book.


I'd like to ask for comments / suggestions before I put it in there 
myself.


I guess it is an "umask" problem. Normally, if your bash startup files 
are set as in the book, umask should be 022 when you are root, and no 
additional instruction should be necessary. OTOH, maybe su does not run 
the bash startup files...


Regards
Pierre
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page