Stuck with visudo! unable to find /etc/group

[b]
Hello All,

this is my first post on this forum and I am new to Asterisk.

Here is the sitrep.

I am in the process of going step by step of:[/b]

With the sudo-related applications and file installed, we can modify the sudoers file.
Execute the visudo command and look for the lines shown below:

visudo

## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL

With the %wheel line uncommented as shown in our example, save the file by pressing
Esc , then typing :wq and pressing Enter .[b] I have done this but nothing shows on screen other than:

root@pbxserver ~]#[/b]

the book then says:

Now open the /etc/group file in your favorite
editor (nano is easy to use) and find the line that starts with the word wheel. Modify it
like so:

wheel:x:10:root,asteriskpbx
Save the file, log out from root by typing exit, and

wheel:x:10:root,asteriskpbx

[b]But where is the file how do I open it??? more info required.

I am running Centos Server and gone the book "Asterisk The Definitive Guide’, and now I am completely stuck at this point.

Please help

Hawk[/b]

The file is /etc/group as stated in the book.
You need to edit the file with one of the many test editors available in Linux.

When you did the ‘visudo’ command you were using the ‘vim’ editor. The “:wq” exited you from the editor and returned you to the shell prompt where you need to issue the next command. That command is to edit the /etc/group file. You can use vim as you did with visudo, however you should have the ‘nano’ editor installed. Many users find nano to be easier to work with than vim.

So back to your problem. To edit the file /etc/group, you would issue the following command.

nano has a command list along the bottom of the screen that will help you with save and exit.

What you are doing right now is actually a Linux thing, not really an Asterisk thing. You are just getting Linux prepared to run Asterisk without problems. You will find it very useful to get a basic understanding of Linux in order to work with Asterisk from the command file as the book does. There are may good references for learn a bit about Linux.

Good luck and have fun.

Dale

Thanks Dale,

I’ll take another look at it. To be fair the book does fail to identify what you just told me.

I must add, that I am running the machine in Virtual Box, and I only have the command line to work with. No Text editors! unless the text editor is part of the cmd line?

Linux has several choices for command line text editors. ‘vi’ and ‘nano’ are just two of them. You will also find a huge following for ‘emacs’, though I am a vi kinda guy. I rarely use a graphical text editor under Linux, though there are several of those available as well.

To be fair to the the book and it’s Authors, the book is about Asterisk and not Linux. They do, and rightfully so, assume that the reader have a basic understanding of the Linux OS and using the command prompt aka the shell. In fact, in the ‘Audience’ section of the Preface they state…

[quote]This book is intended to be gentle toward those new to Asterisk, but we assume that
you’re familiar with basic Linux administration, networking, and other IT disciplines.
If not, we encourage you to explore the vast and wonderful library of books that
O’Reilly publishes on these subjects. We also assume you’re fairly new to telecommunications
(both traditional switched telephony and the new world of Voice over IP).
[/quote]

That being said, you do not have to be a Linux Guru to use Asterisk. As a guy who knew the power and flexibility of Linux well before learning the same about Asterisk, I am happy it to see people who come to learn Asterisk and in the process learn to use, and possibly prefer, Linux.

There is a lot of information available on the web regarding learning Linux. And I am always happy to answer questions.

Welcome to the Asterisk and Linux Communities.

Thank you for your support, I am trying my best to get to grips with it all.

I am stuck again though :blush:

I ran the following commands: yum install nano

All good! I then follow the instructions and type (but I don’t know how this edits the sudoers file). The book says.

[quote]Now we need to provide the asteriskpbx user sudo access. We do this by modifying the
sudoers file with the visudo command. You’ll need to install visudo the first time you
use it:

yum install sudo

With the sudo-related applications and file installed, we can modify the sudoers file.
Execute the visudo command and look for the lines shown below:

visudo

Allows people in group wheel to run all commands

%wheel ALL=(ALL) ALL

With the %wheel line uncommented as shown in our example, save the file by pressing
Esc , then typing :wq and pressing Enter . Now open the /etc/group file in your favorite
editor (nano is easy to use) and find the line that starts with the word wheel. Modify it
[i]like so:

wheel:x:10:root,asteriskpbx

Save the file, log out from root by typing exit, and log in as the asteriskpbx user you
created. Test your sudo access by running the following command:

$ sudo ls /root/
[sudo] password for asteriskpbx:[/quote]

I do:

nano /etc/group/

It then gave me the list as it said it would do, I then scrolled to the line : wheel:x:10:root

and edited it like so: wheel:x:10:root,asteriskpbx

I then pressed Ctrl+O and it saved it. I then pressed Ctrl+X and it exited me out. Should I have saved it to /etc/group/sudoers

As far as I could see it only saved it to /etc/group/

However when I type the cmd: sudo ls /root/ it promts me for the password but does not allow me access.

Please help, sorry for being a newbbbb!!!

There are two files, /etc/sudoer and /etc/group. They perform completely different functions.

/etc/sudoers defines which users and use the command sudo to run other commands as the user root. Because this is a special file for security reasons, it has a special command, visudo, that is used to edit it an ensure that the system permissions are set properly when done.

/etc/group defines which system groups a user belongs two. It is not particularly special as it is accessible to all users to read. Therefore we can simply edit it with the tool of choice. What you did was add the user ‘asteriskpbx’ to the group wheel, which to told sudo was allowed to run any command as root.

In sudoers, you allow members of the group wheel to run commands as root, it did not specify that you would not need a password to do so. When you run ‘sudo ls /root’, the system will prompt you for the current user’s password, not roots. The book, is assuming that you are currently logged in as the user ‘asteriskpbx’. If you are logged in as a different user, the changes you made will not allow this other user access to run sudo.

If you are logged in as asteriskpbx and your are entering the correct password and it still does not allow you to run the sudo command, then I suggest logging out and back in again to ensure your current shell has the update environment (group membership).

Dale

Dale,

Thank you, even though I have not got a clue what your saying :laughing:

is there anyway I could mail you a couple of screen shots to show you what I have done, then maybe you can see where I am going wrong. I am following it to the book as best I can.

When I attempt login at asteriskpbx@asteriskpbx~]$ sudo ls root

It gives a message banner saying 1. respect others etc… 3. with power comes responsibility…

then when I type my password, you know it says asteriskpbx is not in the sudoers group.

Appreciate your time.

The ‘with great power come great responsibility’ message simply means you are running sudo for the first time.
If the error states that the user is not in sudoers file, it means the password was accepted, but it could not find your user or group in sudoers. This means one of two things, the /etc/group file is wrong of the /etc/sudoers file is wrong.

Lets try a couple of things…

login as the root user.

what is the output? You should see this…

what is the output? You should see this…

[quote]## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL

%wheel ALL=(ALL) NOPASSWD: ALL

[/quote]

The lines with a ‘#’ are comments an can be ignored here.
Check your spelling in the /etc/group file in particular.
Also make sure there is no ‘#’ in the ‘%wheel ALL=(ALL) ALL’ line of /etc/sudoers file.

If you still have problems, PM me and I will send you my e-mail address.

Dale

Dale,

Thanks again. Removing the ‘#’ comment prefix from the %wheel line in visudo seems to have done the trick.

Hooray I can continue with the asterisk install.

Thank loads you have been a great help. On the down side guess who I am asking first if I have any more issues ;O)

Neil

My pleasure.

Good luck and feel free to post (or PM me) any further issues.

Dale

Thanks again for your help last week. I thought I would take your offer up on you support.

Here is where I am stuck.

I have carried out the following commands with no problem.

cd ~/src/asterisk-complete/asterisk
wget downloads.asterisk.org/pub/telep … 5.0.tar.gz
tar -xvzf asterisk-1.8*
cd asterisk-1.8*
./configure
make
sudo make install
sudo make config

I then set file permissons like so:

sudo chown -R asteriskpbx:asteriskpbx /usr/lib/asterisk/
sudo chown -R asteriskpbx:asteriskpbx /var/lib/asterisk/
sudo chown -R asteriskpbx:asteriskpbx /var/spool/asterisk/
sudo chown -R asteriskpbx:asteriskpbx /var/log/asterisk/
sudo chown -R asteriskpbx:asteriskpbx /var/run/asterisk
sudo chown asteriskpbx:asteriskpbx /usr/sbin/asterisk

no problems!

I then did:

sudo vim /etc/udev/rules.d/dahdi.rules

and Changed:

SUBSYSTEM==“dahdi”, OWNER=“asterisk”, GROUP=“asterisk”, MODE=“0660”

to read:

SUBSYSTEM==“dahdi”, OWNER=“asteriskpbx”, GROUP=“asteriskpbx”, MODE=“0660”

no problems!

However, when I attempt to build the config files from scratch as opposed to executing the ‘make samples’ cmd; and copy them to the directory correct directory I am a bit stuck.

I am pretty confident that it is just a directory issue, but I am not sure where I am going wrong, I have attempted to run the following cmds with the version edited ie: asterisk 1.8.*

Here is what I need to be addressed (I think)

From book:

cp ~/src/asterisk-complete/asterisk/1.8/configs/indications.conf.sample
/etc/asterisk/indications.conf

Because we’re running Asterisk as non-root, we need to tell Asterisk which user to run
as. This is done with the asterisk.conf file. We can copy a sample version of it from the
Asterisk source to /etc/asterisk:

$ cp ~/src/asterisk-complete/asterisk/1.8/configs/asterisk.conf.sample
/etc/asterisk/asterisk.conf

I am struggling to see where I am going wrong. And yes it most probably a lack of linux file system knowledge that’s giving me the hold up.

Hope you can help

Thanks Dale.

Neil
hawkstringer
Newsterisk

Posts: 5
Joined: Sat Mar 03, 2012 7:52 am

Neil,

Are you getting permission denied errors while doing the copy command?

If so, I noticed in the list of directories that you did the ‘sudo chown …’ commands on, /etc/asterisk was not included. You should set that up as well.

If you are not getting permission denied errors, what error are you seeing?

Dale, thanks for reply,

No I get the following message.

No such file or directory

BTW. I have done this but forgot to mention it:

$ sudo mkdir /etc/asterisk/
$ sudo chown asteriskpbx:asteriskpbx /etc/asterisk/

Neil

Hi I have located the files:

/src/asterisk-complete/asterisk/asterisk-1.8.5.0/configs/indications.conf.sample

and

/src/asterisk-complete/asterisk/asterisk-1.8.5.0/configs/asterisk.conf.sample

and the book tells me to copy these files to the

/etc/asterisk directory

The following lines have been displayed:

[asteriskpbx@pbxserver ~]$ ls /etc/asterisk
indications.conf
[asteriskpbx@pbxserver ~]$ cd /etc/asterisk
[asteriskpbx@pbxserver asterisk]$ nano asterisk.conf
[asteriskpbx@pbxserver asterisk]$ ls /etc/asterisk
asterisk.conf indications.conf

But both files are empty, obviously because nothing has been copied to them yet. but that is what I need to do.

I think my copy commands must be wrong???

All done. just realised my error. sorry.

:blush: :blush: :blush:

Sounds like you are make good progress and learning some new things!
Don’t be embarrassed, I find you learn more if things don’t always work the first time. I call this… experience.

Let me know if anything else come up.

Deleted by hawkstringer, non essential information.

Hi sorry I am struggling again.

racking my mind over this:

I wish to install libnewt-devel for menuselect. but getting this:

[b][asteriskpbx@pbxserver ~]$ sudo yum install libnewt-devel.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

I get the same output when I type:

[b][asteriskpbx@pbxserver ~]$ sudo yum install libnewt-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

I also tried

But still I get the output:
No package libnewt-devel available.

Any thoughts?

Neil


is handy if you do not know the exact package name.  (I am escaping the * to make sure the shell does not expand it, but that is another topic.)

I found the package [b]newt-devel[/b] for my 32-bit system.  I also do not put the architecture info on the install line and let the system look for the appropriate package.

In other words, try...
[code]sudo yum install newt-devel[/code]

is handy if you do not know the exact package name. (I am escaping the * to make sure the shell does not expand it, but that is another topic.)

I found the package newt-devel for my 32-bit system. I also do not put the architecture info on the install line and let the system look for the appropriate package.

In other words, try…

worked a treat.

Thanks again Dale.

Neil