LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2014, 03:32 PM   #1
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Rep: Reputation: Disabled
edit conf files via samba


I would like to edit the various conf files of an arch linux install (for example nginx.conf) from a windows machine. I have got samba up and running, and i can log (as user "aagaag") into the appropriate shares and open the files (e.g. /etc/nginx/nginx.conf).

However, the conf files are all read-only. I understand that they are owned by root, and indeed user "aagaag" can only edit them by doing "sudo nano". But how can I "sudo" from a Windows client through Samba? Sorry for this probably brain-dead question.
 
Old 12-27-2014, 03:44 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Not a good idea even if you could do it.

sudo (and su) are not usable via Samba.

Editing any /etc file via Samba opens the system up to destruction by allowing the Samba configurations up as well - you will be giving root access to Samba.

Some systems won't even let you as the required security labels conflict.
 
Old 12-27-2014, 04:00 PM   #3
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
Thank you. I appreciate your answer, and I was of course expecting this kind of advice - which is well-meant but does not address my question.

My system is at home, it is isolated, and it is being set up for the purpose of learning linux and python. Nothing productive will be done with it. I realize that hackers may want to possess the system and do mayhem with it, but it is behind a firewall in a typical home setup.

So, if I wanted to accept the inherent risks, how would I have to proceed? Can I enable root via samba?
 
Old 12-27-2014, 04:08 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997
Instead of kicking against the built in security - and exposing your machine to corruption - why not just use the right tools for the job, ssh in this case, instead of samba?

Let aagaag remote login via ssh, then sudo as desired.

Last edited by astrogeek; 12-27-2014 at 04:10 PM. Reason: tpos, typs, typos...
 
Old 12-27-2014, 04:17 PM   #5
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
Instead of kicking against the built in security - and exposing your machine to corruption - why not just use the right tools for the job, ssh in this case, instead of samba?

Let aagaag remote login via ssh, then sudo as desired.
Well, yes, that's what I have been doing thus far. It's doable and it works. But it's like going back to 1980, when word processors did not exist. Was just wondering if this is what everybody has to go through, or if there is any better way.
 
Old 12-27-2014, 04:25 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997
Quote:
Originally Posted by aagaag View Post
Well, yes, that's what I have been doing thus far. It's doable and it works. But it's like going back to 1980, when word processors did not exist. Was just wondering if this is what everybody has to go through, or if there is any better way.
No offense intended, but what a very strange perspective...

I cannot help with samba and would say again that it is definitely not the right tool for the job, regardless of how modern it is!

SSH is the right tool for the job and is also very cool and 2014-ish! It is not something that you go through (again, how strange a remark...), it is something that you use.

Anyway, good luck!
 
Old 12-27-2014, 04:27 PM   #7
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
what about setting up a group "admins", assigning it to /etc and /usr recursively, and chmod g+rw to all *.conf and *.cfg files?
 
Old 12-27-2014, 05:17 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997
Quote:
Originally Posted by aagaag View Post
what about setting up a group "admins", assigning it to /etc and /usr recursively, and chmod g+rw to all *.conf and *.cfg files?
That has potential to break quite a number of things in unexpected ways. And I am not sure what you think that you would gain by that in any case.

It seems to me that your goal is to use W1ndow$ word processor applications to edit Linux configs without regard to the underlying filesystem and security permissions - in which case you are on your own!

Wind0w$ editors will also break Linux text files in multiple ways, so...

Linux ownerships and permissions are as they are for many good reasons, so...

I can only advise again, use the right tool for the job, in the intended manner...

Perhaps someone else can offer other insights.
 
Old 12-27-2014, 05:59 PM   #9
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
OK, I accept that. Let me rephrase. How do you copy a big chunk of text (say, 1000 lines) from a document in one Putty SSH window, and paste it into another document in a different putty window. If I knew how to do that, I might not need a Windows editor like notepad++.
 
Old 12-27-2014, 07:52 PM   #10
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997
Quote:
Originally Posted by aagaag View Post
OK, I accept that. Let me rephrase. How do you copy a big chunk of text (say, 1000 lines) from a document in one Putty SSH window, and paste it into another document in a different putty window. If I knew how to do that, I might not need a Windows editor like notepad++.
I am not a putty user so do not know what it supports as far as copy/paste. You might search here and the internet for putty help, I have seen many threads related to it over the yeaars.
 
Old 12-28-2014, 07:21 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by aagaag View Post
OK, I accept that. Let me rephrase. How do you copy a big chunk of text (say, 1000 lines) from a document in one Putty SSH window, and paste it into another document in a different putty window. If I knew how to do that, I might not need a Windows editor like notepad++.
That is up to putty and Windows, not Linux.

It works quite well for me, but then I'm using ssh and linux. Even then, it is up to the applications running. Some terminal emulators work better than others. Sometimes I'll use scp an copy the file locally as I don't necessarily know ahead of time which 1000 lines I may want.

One problem with using Windows editors at any time is that they WILL inject invalid characters into files. One notable bad character is the "return" character. This tends to cause problems in parsing files because it IS invalid for Linux files (end of line is indicated by a newline character). Other bad characters show up as well (the apostrophe on Windows is not always the apostrophe character). Linux "text" files are not Windows text files.

Last edited by jpollard; 12-28-2014 at 07:23 AM.
 
Old 12-28-2014, 10:36 AM   #12
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
What text editor are you using in Linux? If you find it limiting, maybe it's time to switch to something more powerful, e.g. vi or emacs if you're using something like nano currently. I assure you that every Linux admin I know does their job by editing text files over an ssh connection. If you want a pretty graphical text editor (most people don't), you can always install an X server on your Windows machine and use X11 forwarding over ssh. This, however, requires you to have the graphical word processor installed on the Linux side, and most servers don't have such things installed.
 
Old 12-29-2014, 04:39 AM   #13
aagaag
Member
 
Registered: Aug 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
Dear btmiller and all other contributors. Thank you so much for your help. For me, Linux text editing is really tough love. I read from the vi tutorial: "vi was designed with the Qwerty keyboard (containing no arrow keys) in mind". I conclude that my feeling of going back to 1980 was optimistic: no arrow keys is more like 1960! But don't get me wrong: I love Linux and I am happy to have delved into it. I am just testing the perimeter of what's doable.


I do second your concerns with the Windows text editors introducing illegal characters, but on the other Hand with Notepad++ text blocks can be commented-out, commented-in, indented and dedented, which I find great for testing conf files.

I guess that a compromise solution may be to use the Antergos GUI and some Linux-based WYSIG editors. Many thanks to everybody again, and happy new year!
 
Old 12-29-2014, 05:10 AM   #14
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
vi was designed for efficiency, and effectiveness.

It takes quite a while to move your hand from a keyboard to a mouse and back. Everyone I've met has to look to see if they got their hands placed correctly.

It also takes longer using the arrow keys (and yes, they work).

Vi happens to be one of the fastest editors to use. vim (usually called vi) also has a GUI mode...

And you haven't even looked at Emacs yet. It has a full GUI editor... and much much more.
 
Old 12-29-2014, 08:42 PM   #15
Doug G
Member
 
Registered: Jul 2013
Posts: 594

Rep: Reputation: Disabled
If you're in a completely trusted network environment, you can set up a samba share to /etc using force user = root. If you use selinux it will object, and you'll have to make appropriate selinux changes too. Then make sure you use a windows text editor on conf files that understands and maintains linux line breaks (not notepad).

If you just want to use a windows text editor on your conf files, you can use winSCP, which connects over ssh. winscp allows you to configure which windows text editors to use when editing files.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't edit files over samba nglbrkr Linux - Newbie 4 10-30-2012 08:29 PM
How to edit files with xemacs over Samba share? Samba problem? rylan76 Linux - Software 1 11-13-2008 02:00 AM
Ubuntu Server HaryH -edit samba.conf gpb Linux - Server 1 08-01-2008 01:39 PM
Cannot edit .conf files Lucky13 Linux - Newbie 5 12-13-2006 07:46 PM
How to edit /etc/samba/smb.conf dazzyboi Linux - Newbie 3 07-26-2004 05:36 PM


All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration