how do I login as admin on ubuntu server samba conf

I need to have a way to login as admin on a new install of ubuntu server.  I tried to log in as user root with my build password and that does not work.   My problem is I need to change the samba server's conf file.  Using sudo it says I don't have permissions when I log in with my regular user id.  It did let me wipe out the permissions on the dir /etc/ which I somehow did by accident.  3 reload of the server.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you need to use su -
You should be able to login as root on console.  you would then need to modify the /etc/ssh/sshd_config and uncomment the AllowRootLogin yes option.  once sshd restarts it would allow root to login via ssh.
You may need to use the LiveCd and then update the /etc/passwd and /etc/shadow as well as /etc/sudoers for use with sudo.

It is not clear from what you've said when your regular user id allowed you to wipe permissions on the /etc dir.

What are the permissions on the samba conf file? Can you list the permissions with 'ls -l' and post the result here?

Regards, Tobias
if you have managed to wipe your /etc/ directory clean then your SUDO rights are also gone.

best would be run a rescue through CD and install the missing parts or do a minimal installation without formatting the partitions

would be too tedious otherwise to create all system critical files like shadow, passwd, groups, sudoers and a whole load of other things
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

grurbanAuthor Commented:
I didn't wipe the directorys, I somehow changed the permissions to -rwxrwxrwx.  I want to logon as root so the I have those permissions when I bring up gui desktop.  that way I can use the wisiwyg editors.  I have rebuilt the system entirely again.  Now ready to mess up again.
Don't log in as root in Ubuntu.

Either use 'su -' or sudoers.

Regards, Tobias
Daniel McAllisterPresident, IT4SOHO, LLCCommented:
The key difference I think you're missing grurban is the difference between

The former simply elevates a login shell to root status (and the best way to so that is actually "su -" not just plain "su").
The latter allows a user to run root-required programs without getting full-scale root privileges

The "su -" command will prompt you for the ROOT password...
The "sudo" command will prompt you for your OWN password...

After running the "su -" program, you can do whatever root can do -- you ARE root!
After running a "sudo" program, you are returned to your restricted user... you have to use sudo again (or su!) to regain root elevation again.

I hope this explains things a little.


OH! And it is considered VERY risky to leave root login access on SSH (which is why it is disabled by default). The CORRECT (SAFE)way to login as root via SSH is to login as your "regular" user account, then use "su -" to become a root user.

I have taught that to EVERY system admin course I have ever taught (Linux, HP/UX, Solaris, AIX... the lot of them!)
grurbanAuthor Commented:
How do I do this and use the gui editor from the desktop?
su and sudo in the end do the same thing, both elevate the current users rights. The difference for su you have to know root's password and there is no limitation/configuration settings that would limit what you can then do on the system.  sudo uses the configuration file /etc/sudoers and your own password to grant access to root level based on the configuration file.

i.e. is /etc/sudoers for your username or the group of which you are a member grants all rights, that means that using sudo you can access and run all commands as root on the system.
sudo bash is in effect the same as running su -
once the correct password is provided, both have a root level shell.

while the limited user open a terminal session
xhost localhost #grant other users the ability to send xterms to your user session
"su -" or "sudo bash" #in the shell
export DISPLAY=localhost:0.0
emacs or whatever GUI you want to run.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Server Software

From novice to tech pro — start learning today.