2

Below is the config i am using

[global]
workgroup = WORKGROUP
netbios name = CDA
security = user
map to guest = Bad User
username map = /etc/samba/smbusers
guest account = nobody
guest ok = yes
log file = /var/log/samba.log.%m
log level = 2
max log size = 1000
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printing = bsd

[custom_home]
  path = /opt/asdf/custom_home
  read only = no
  browseable = yes
  create mask = 0777
  directory mask = 0777
  valid users = @writer

I have created a new system user and added it to the group writer.

I have also ran the below command for samba password.

sudo smbpasswd -a testuser

I have given 0777 permission to the folder and owner of the folder is the writer group. I am still unable to write to the folder. :(


As requested:

[global]
workgroup = WORKGROUP
netbios name = CDA
security = user
map to guest = Bad User
username map = /etc/samba/smbusers
guest account = nobody
guest ok = yes
log file = /var/log/samba.log.%m
log level = 2
max log size = 1000
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printing = bsd

[pi_home]
  path = /opt/oracle/psft/pt/pi_home
  writable = no
  available = yes

[tools_client]
  path = /opt/oracle/psft/pt/tools_client
  writable = no
  available = yes

[ps_app_home]
  path = /opt/oracle/psft/pt/ps_app_home
  writable = no
  available = yes

[ps_home]
  path = /opt/oracle/psft/pt/ps_home8.55.11
  writable = no
  available = yes

[custom_sqr_pshome]
  path = /opt/oracle/psft/pt/ps_home8.55.11/sqr_custom
  read only = no
  available = yes
  browseable = yes
  writable = yes
  guest ok = no
  public = yes
  locking = no
  strict locking = no
  create mask = 0777
  directory mask = 0777
  valid users = sqruser

[custom_sqr_psapphome]
  path = /opt/oracle/psft/pt/ps_app_home/sqr_custom
  read only = no
  available = yes
  browseable = yes
  writable = yes
  guest ok = no
  public = yes
  locking = no
  strict locking = no
  create mask = 0777
  directory mask = 0777
  valid users = sqruser
2

Remove samba by executing following commands

sudo apt-get remove --purge samba
sudo apt-get remove --purge smbclient libsmbclient
sudo apt-get purge samba samba-common
sudo rm -rf /etc/samba/ /etc/default/samba

Install it again

sudo apt-get install samba
sudo apt-get install smbclient libsmbclient

Now original smb.conf has been restored so restart Ubuntu then add user from terminal.

root@Dell-Inspiron-3521:~# sudo smbpasswd -a username (username should be without space eg "sudo smbpasswd -a alamjitsingh")
New SMB password:*********
Retype new SMB password:*********
Added user alamjitsingh.

Now edit smb.conf file as follows. Mentioned lines must be present in the the code.

sudo gedit /usr/share/samba/smb.conf


[global]
 workgroup = WORKGROUP
 passdb backend = tdbsam 
 security = user

[Optional] If you want to share folder which are inside opt directory then you also have to add following line in global section.

usershare owner only = False

In authentication section turn "map to guest = bad user" off by adding # at starting of code

#map to guest = bad user

At last add your personal code

   [sqr_custom]
path = /opt/oracle/psft/pt/ps_home8.55.11/sqr_custom
comment = Personal_Share
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = yes
printable = no
locking = no
strict locking = no

Apart from this your shared folder is in opt folder which require permissions to write. So firstly test this prog by sharing folder of home directory. Then we will proceed further. To know correct path of shared folder drag and drop folder on running terminal.


If you are succeed to run above code then do the following

To create a group:

sudo groupadd demoGroup

To add the user account to the group:

sudo usermod -G demoGroup username(eg alamjitsingh)

For setting permissions of writing

sudo chown -R username:groupname /opt/demo

eg

sudo chown -R alamjitsingh:demogroup /opt/demo

Following lines are for granting the write access to members of the demoGroup in directory demo (It will grant all demoGroup members to write)

sudo chgrp -R demogroup /opt/demo
sudo chmod 2770 /opt/demo

Restart services

sudo service nmbd restart
sudo service smbd restart

eg of shared folder of restricted directory with write privilege

[demo]
path = /opt/demo
comment = HD Share
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = yes
printable = no
locking = no
strict locking = no
force create mode = 0660
force directory mode = 2770
force user = alamjitsingh
force group = demogroup
| improve this answer | |
  • nopes not working :( – Vipin Jain Mar 6 '17 at 9:37
  • Hi I need output of these two commands to understand your system : " sudo net usershare info --long " and " smbclient -L localhost ". – Alamjit Singh Mar 6 '17 at 11:18
  • [psuser@psfscm ~]$ sudo net usershare info --long [sudo] password for psuser: net usershare: usershares are currently disabled [psuser@psfscm ~]$ smbclient -L localhost -bash: smbclient: command not found – Vipin Jain Mar 6 '17 at 13:04
  • 1
    check your system selinux should not be installed if you want to share anything, type in terminal - " selinuxenabled && echo enabled || echo disabled ". You have to disable it otherwise it will only let you read but not write in shared directory. As per my opinion this error is due to other application related to security or due to wrong settings of smb.conf file. So tell me version of samba by entering " sudo samba -V " in terminal. So that I can send you appropriate original conf file. – Alamjit Singh Mar 6 '17 at 14:10
  • This is last what I can do for you. Above settings which I shared with you are currently working fine on my system with latest version of samba. – Alamjit Singh Mar 6 '17 at 14:11
1

Try below mentioned code

[global]
workgroup = WORKGROUP
netbios name = CDA
passdb backend = tdbsam 
security = user
#map to guest = Bad User
username map = /etc/samba/smbusers
guest account = nobody
guest ok = yes
log file = /var/log/samba.log.%m
log level = 2
max log size = 1000
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printing = bsd



[custom_home]
  path = /opt/asdf/custom_home
  read only = no
  available = yes
  browseable = yes
  writable = yes
  guest ok = no
  public = yes
  locking = no
  strict locking = no
  create mask = 0777
  directory mask = 0777
  valid users = @writer (if writer is not username remove this line i think, you added user name = testuser so remove this line)

Most probably testuser is your user name to access this shared folder. In windows 10 you have to "Add a Network Location" manually, eg- "\\192.168.1.3\ Shared_folder_name" then it will ask for username and password. Find this option->Add a Network Location in windows 10. In android devices you can access this shared directory via "ES file explorer" app. If still not working intimate me. Good luck.

| improve this answer | |
  • Still unresolved.... :( – Vipin Jain Mar 5 '17 at 14:18
  • I can send you my vpn so you can directly resolve this issue. – Vipin Jain Mar 5 '17 at 14:20
  • do you have code of original smb.conf file ? also tell me what is version of samba which you are using by typing samab -V in terminal. – Alamjit Singh Mar 5 '17 at 15:06
  • Here you go @Alamjit – Vipin Jain Mar 5 '17 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.